MATLAB实验图.docx
《MATLAB实验图.docx》由会员分享,可在线阅读,更多相关《MATLAB实验图.docx(16页珍藏版)》请在冰点文库上搜索。
![MATLAB实验图.docx](https://file1.bingdoc.com/fileroot1/2023-5/9/b43bb1ff-c42a-4f14-a0cc-4c74e62445bd/b43bb1ff-c42a-4f14-a0cc-4c74e62445bd1.gif)
MATLAB实验图
实验一
实验二
n=0:
40;
D=10;
a=3;b=-2;
x1=cos(2*pi*0.1*n);
x2=cos(2*pi*0.4*n);
x3=cos(2*pi*0.1*(n+D));
x4=cos(2*pi*0.4*(n+D));
x=a*x1+b*x2;
yt=a*x3+b*x4;
d=y-yt;
subplot(3,1,1);
stem(n,x);
subplot(3,1,2);
stem(n,yt);
subplot(3,1,3);
stem(n,d);
n=0:
40;
x=cos(2*pi*0.1*n);
num=[2.24032.49082.2403];
den=[1-0.40.75];
ic=[0,0];
yt=impz(num,den,n)
stem(yt);
实验三
DFT128点采样
t=0:
0.01:
1.28;
x=sin(2*pi*20*t)+sin(2*pi*20.5*t)+sin(2*pi*40*t);subplot(2,1,1);
plot(x(1:
50));
y=fft(x,128);
f=100*(0:
64)/128;
subplot(2,1,2);
plot(f,y(1:
65));
t=0:
0.01:
1.28;
x=sin(2*pi*20*t)+sin(2*pi*20.5*t)+sin(2*pi*40*t);
subplot(2,1,1);
plot(x(1:
50));
y=fft(x,512);
f=100*(0:
256)/512;
subplot(2,1,2);
plot(f,y(1:
257));
t=0:
0.01:
5.12;
x=sin(2*pi*20*t)+sin(2*pi*20.5*t)+sin(2*pi*40*t);
subplot(2,1,1);
plot(x(1:
50));
y=fft(x,512);
f=100*(0:
256)/512;
subplot(2,1,2);
plot(f,y(1:
257));
n=0:
40;
x=[n(1:
20)40-n(21:
40)0];
subplot(3,1,1);
stem((0:
40),x);
y=fft(x,64);
f=2*(0:
32)/64;
subplot(3,1,2);
stem(f,y(1:
33));
y1=y(1:
2:
64)
subplot(3,1,3);
f=2*(0:
16)/32;
stem(f,y1(1:
17));
n=0:
40;
x=[n(1:
20)40-n(21:
40)0];
subplot(3,1,1);
stem((0:
40),x);
y=fft(x,64);
f=2*(0:
32)/64;
z=ifft(y);
subplot(3,1,2);
stem(z);
y1=y(1:
2:
64);
f=2*(0:
16)/32;
z1=ifft(y1)
subplot(3,1,3);
stem(z1);
实验五
wp=2*pi*500;ws=2*pi*600;Rp=1;As=50;
[N,wc]=buttord(wp,ws,Rp,As,'s');
[B,A]=butter(N,wc,'s');
freqz(B,A,512,2000);
wp=600/1000;ws=700/1000;
[n,wn]=ellipord(wp,ws,0.1,50);
[b,a]=ellip(n,0.1,50,wn);
freqz(b,a,1024,2000)
实验6
wn=[0.40.7];
windows1=hamming(39);
b1=fir1(38,wn,'stop',windows1);
subplot(2,2,1)
freqz(b1,1,512);
windows2=chebwin(39);
b2=fir1(38,wn,'stop',windows2);
subplot(2,2,2)
freqz(b2,1,512);