Documente Academic
Documente Profesional
Documente Cultură
f0
n+ )
fs
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
0.11
f=8000;
f0=300;
n= [0.01:0.001:0.10]
a=f./f0;
x=sin(2*3.14*a*n);
stem(n,x)
12-EE-109
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
0.11
b) Vary the frequency f0 from 100 Hz to 475 Hz, in steps of 125 Hz.
The apparent frequency of the sinusoid should be increasing, as
expected. Use subplot to put four plots on one screen.
f=8000;
f0=100;
n= [0.01:0.001:0.10]
a=f./f0;
x=sin(2*3.14*a*n);
subplot(2,2,1);
stem(n,x)
f=8000;
f0=225;
n= [0.01:0.001:0.10]
a=f./f0;
x=sin(2*3.14*a*n);
subplot(2,2,2);
stem(n,x)
f=8000;
f0=350;
n= [0.01:0.001:0.10]
a=f./f0;
x=sin(2*3.14*a*n);
subplot(2,2,3);
stem(n,x)
f=8000;
f0=475;
n= [0.01:0.001:0.10]
a=f./f0;
x=sin(2*3.14*a*n);
subplot(2,2,4);
stem(n,x)
12-EE-109
0.5
0.5
-0.5
-0.5
-1
0.05
0.1
-1
0.5
0.5
-0.5
-0.5
-1
0.05
0.1
-1
0.05
0.1
0.05
0.1
12-EE-109
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0.05
0.1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0.05
0.1
0.05
0.1
0.05
0.1
12-EE-109
subplot(2,2,4);
stem(n,x)
0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0.05
0.1
0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0.05
0.1
0.05
0.1
0.05
0.1
Question 02
a) Simulate a continuous sinusoid signal by generating samples
separated by a small
interval of t = 1/80000 second (time resolution):
x(t) = cos(2f0t) cos(2f0 n t) , n=0,1,2,...
Plot as a continuous function 1000 samples of the resulting signal
when the frequency f0 is 2 kHz.
f=2000;
n= [0.01:0.0000125:0.015]
a=f*n;
x=cos(6.28*a);
stem(n,x)
12-EE-109
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0.01
0.0105 0.011 0.0115 0.012 0.0125 0.013 0.0135 0.014 0.0145 0.015
12-EE-109
4000
3500
3000
2500
2000
1500
1000
500
0
0.5
1.5
2
Frequency
2.5
3.5
4
4
x 10
12-EE-109
400
350
300
250
200
150
100
50
0
500
1000
1500
2000
Frequency
2500
3000
3500
4000
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
1.05
1.1
1.15
1.2
1.25
1.3
1.35
1.4
1.45
1.5
7
x 10
function freqmagplot(x,dt)
f=2000;
n= [10000000:12500:15000000]
a=f*n;
x=cos(6.28*a);
12-EE-109
plot(n,x)
dt=12500;
L=length(x);
Nfft=round(2.^round(log2(5*L)));
X=fft(x,Nfft);
f=((1/dt)/Nfft)*(0:1:Nfft/2-1);
plot(f,abs(X(1:Nfft/2)));
title('Magnitude of Fourier Transform');
xlabel('Frequency'),grid;
Magnitude of Fourier Transform
250
200
150
100
50
0.5
1.5
2
Frequency
2.5
3.5
4
-5
x 10
e) Plot the signal at the output if the filter, discard the first 200
samples (transient response) and plot the continuous time Fourier
transform of the resulting signal. Compare with (b).
f=2000;
n= [10000000:12500:15000000]
a=f*n;
x=cos(6.28*a);
fs=8000;
[b,a]=cheby2(9,60, fs *1/80000)
y = filter(b,a,x);
plot(n,y)
12-EE-109
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0.01
0.0105 0.011 0.0115 0.012 0.0125 0.013 0.0135 0.014 0.0145 0.015
function freqmagplot(x,dt)
f=2000;
n= [10000000:12500:15000000]
a=f*n;
x=cos(6.28*a);
fs=8000;
[b,a]=cheby2(9,60, fs *1/80000)
y = filter(b,a,x);
plot(n,y)
dt=12500;
L=length(y);
Nfft=round(2.^round(log2(5*L)));
X=fft(y,Nfft);
f=((1/dt)/Nfft)*(0:1:Nfft/2-1);
plot(f,abs(X(1:Nfft/2)));
title('Magnitude of Fourier Transform');
xlabel('Frequency'),grid;
12-EE-109
4000
3500
3000
2500
2000
1500
1000
500
0
0.5
1.5
2
Frequency
2.5
3.5
4
4
x 10
12-EE-109