Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
t=(1:100)/Fs
w=2*pi*10
f=(8/pi)*(sin(w*t)+(1/3)*sin(3*w*t)+(1/5)*sin(5*w*t)+(1/7)*sin(7*w*t)+(1/9)*sin(9*w*t))
plot(t,f)
grid
Fs =
1000
t=
Columns 1 through 23
0.0010 0.0020 0.0030 0.0040 0.0050 0.0060 0.0070 0.0080 0.0090 0.0100
0.0110 0.0120 0.0130 0.0140 0.0150 0.0160 0.0170 0.0180 0.0190 0.0200
0.0210 0.0220 0.0230
Columns 24 through 46
0.0240 0.0250 0.0260 0.0270 0.0280 0.0290 0.0300 0.0310 0.0320 0.0330
0.0340 0.0350 0.0360 0.0370 0.0380 0.0390 0.0400 0.0410 0.0420 0.0430
0.0440 0.0450 0.0460
Columns 47 through 69
0.0470 0.0480 0.0490 0.0500 0.0510 0.0520 0.0530 0.0540 0.0550 0.0560
0.0570 0.0580 0.0590 0.0600 0.0610 0.0620 0.0630 0.0640 0.0650 0.0660
0.0670 0.0680 0.0690
Columns 70 through 92
0.0700 0.0710 0.0720 0.0730 0.0740 0.0750 0.0760 0.0770 0.0780 0.0790
0.0800 0.0810 0.0820 0.0830 0.0840 0.0850 0.0860 0.0870 0.0880 0.0890
0.0900 0.0910 0.0920
w=
62.8319
f=
Columns 1 through 23
0.7828 1.4673 1.9771 2.2741 2.3647 2.2947 2.1350 1.9614 1.8357 1.7918
1.8310 1.9270 2.0384 2.1234 2.1545 2.1253 2.0514 1.9630 1.8936 1.8677
1.8929 1.9581 2.0378
Columns 24 through 46
2.1018 2.1261 2.1018 2.0378 1.9581 1.8929 1.8677 1.8936 1.9630 2.0514
2.1253 2.1545 2.1234 2.0384 1.9270 1.8310 1.7918 1.8357 1.9614 2.1350
2.2947 2.3647 2.2741
Columns 47 through 69
1.9771 1.4673 0.7828 -0.0000 -0.7828 -1.4673 -1.9771 -2.2741 -2.3647 -2.2947 -
2.1350 -1.9614 -1.8357 -1.7918 -1.8310 -1.9270 -2.0384 -2.1234 -2.1545 -2.1253 -
2.0514 -1.9630 -1.8936
Columns 70 through 92
-1.8677 -1.8929 -1.9581 -2.0378 -2.1018 -2.1261 -2.1018 -2.0378 -1.9581 -1.8929
-1.8677 -1.8936 -1.9630 -2.0514 -2.1253 -2.1545 -2.1234 -2.0384 -1.9270 -1.8310 -
1.7918 -1.8357 -1.9614
N=128
t=linspace(0,3,N)
f=2*exp(-20*t)
figure(1)
plot(t,f)
xlabel('Time,seg'),ylabel('f(t)'),grid
axis([0 0.3 0 2])
Ts=t(2)-t(1)
Ws=2*pi/Ts
F=fft(f)
Fp=F(1:N/2+1)*Ts
W=Ws*(0:N/2)/N
figure(2)
plot(W,abs(Fp),'+')
xlabel('Frequency,Rad/s'),ylabel('|F(W)|')
N=128
t=linspace(0,3,N)
Ts=t(2)-t(1)
Ws=2*pi/Ts
W=Ws*(0:N/2)/N
Fa=2./(20+j*W)
figure(3)
plot(W,abs(Fa))
xlabel('Frequency,Rad/s'),ylabel('|F(W)|')
m=[0,1,2,3,4,5];
Xn=[1,2,3,4,5,6];
Xk=fft(Xn);
Xmag=abs(Xk);
Xphase=angle(Xk);
figure(1)
plot(m,Xmag), axis([0 5 0 23]);
figure(2)
stem(m,Xmag)
figure(3)
stem(m,Xphase)
t=0:0.001:0.6;
x=sin(2*pi*50*t)+sin(2*pi*120*t);
y=x+2*randn(size(t));
figure(4)
plot(y(1:50))
Y=fft(y,512);
Pyy=Y.*conj(Y)/512;
f=1000*(0:255)/512;
figure(5)
plot(f,Pyy(1:256))
Fs=100;
t=(1:100)/Fs;
s1=5*sin(2*pi*t*5); s2=10*sin(2*pi*t*15); s3=7*sin(2*pi*t*30);
s=s1+s2+s3;
figure(1)
plot(t,s);
S=fft(s,512);
w=(0:255)/256*(Fs/2);
figure(2)
plot(w,abs([S(1:256)]));
fplot('5*sin(x)./x',[-30 30 -.2 6 ])
title('Fplot of f(x)=5.sin(x)/x')
xlabel('x')
f=[0 .4 .4 .6 .6 1];
H=[0 0 1 1 0 0];
fs=1000;
fhz=f*fs/2;
figure(1)
plot(fhz,H), title('Desired Frequency Response')
xlabel('Frequency(Hz)'), ylabel('Magnitude')
N=8;
[Bh,Ah]=yulewalk(N,f,H)
n=256;
hh=freqz(Bh,Ah,n);
hy=abs(hh);
ff=fs/(2*n) * (0:n-1);
figure(2)
plot(fhz,H,ff,hy)
title('Actual vs. Desired Frequency Response')
xlabel('Frequency(Hz)'), ylabel('Magnitude')
figure(1)
plot(t,s)
axis([0 0.01 -4 4]);
[b,a]=ellip(4,0.1,40,[100 1000]*2/Fs);
[H,w]=freqz(b,a,512);
figure(2)
plot(w*Fs/(2*pi),abs(H));
sf1=filter(b,a,s);
figure(3)
plot(t,sf1);
xlabel('Tiempo(seg)');ylabel('FORMA DE ONDA VS. TIEMPO')
axis([0 0.01 -4 4]);
S1=fft(s,513);
SF1=fft(sf1,513);
w=(0:255/256*(Fs/2));
figure(4)
plot(w,abs([S1(1:256) 'SF1(1:256)']));
xlabel('FRECUENCIA(Hz)');ylabel('MAG. DE TRANF. DE
FOURIER');
[b,a]=ellip(4,0.1,40,[1000 2000]*2/Fs);
[H,w]=freqz(b,a,512);
figure(5)