资源描述
练习三实验三五1help windowWINDOW Window function gateway. WINDOW(WNAME,N) returns an N-point window of type specified by the function handle WNAME in a column vector. WNAME can be any valid window function name, for example: bartlett - Bartlett window. barthannwin - Modified Bartlett-Hanning window. blackman - Blackman window. blackmanharris - Minimum 4-term Blackman-Harris window. bohmanwin - Bohman window. chebwin - Chebyshev window. flattopwin - Flat Top window. gausswin - Gaussian window. hamming - Hamming window. hann - Hann window. kaiser - Kaiser window. nuttallwin - Nuttall defined minimum 4-term Blackman-Harris window. parzenwin - Parzen (de la Valle-Poussin) window. rectwin - Rectangular window. tukeywin - Tukey window. triang - Triangular window. WINDOW(WNAME,N,OPT) designs the window with the optional input argument specified in OPT. To see what the optional input arguments are, see the help for the individual windows, for example, KAISER or CHEBWIN. WINDOW launches the Window Design & Analysis Tool (WinTool). EXAMPLE: N = 65; w = window(blackmanharris,N); w1 = window(hamming,N); w2 = window(gausswin,N,2.5); plot(1:N,w,w1,w2); axis(1 N 0 1); legend(Blackman-Harris,Hamming,Gaussian); See also bartlett, barthannwin, blackman, blackmanharris, bohmanwin, chebwin, gausswin, hamming, hann, kaiser, nuttallwin, parzenwin, rectwin, triang, tukeywin, wintool. Overloaded functions or methods (ones with the same name in other directories) help fdesign/window.m Reference page in Help browser doc window2.N = 128;w = window(rectwin,N);w1 = window(bartlett,N);w2 = window(hamming,N);plot(1:N,w,w1,w2); axis(1 N 0 1);legend(矩形窗,Bartlett,Hamming);3.wvtool(w,w1,w2)六ts=0.01;N=20;t=0:ts:(N-1)*ts;x=2*sin(4*pi*t)+5*cos(6*pi*t);g=fft(x,N);y=abs(g)/100;figure(1):plot(0:2*pi/N:2*pi*(N-1)/N,y);grid;ts=0.01;N=30;t=0:ts:(N-1)*ts;x=2*sin(4*pi*t)+5*cos(6*pi*t);g=fft(x,N);y=abs(g)/100;figure(2):plot(0:2*pi/N:2*pi*(N-1)/N,y);grid;ts=0.01;N=50;t=0:ts:(N-1)*ts;x=2*sin(4*pi*t)+5*cos(6*pi*t);g=fft(x,N);y=abs(g)/100;figure(3):plot(0:2*pi/N:2*pi*(N-1)/N,y);grid;ts=0.01;N=100;t=0:ts:(N-1)*ts;x=2*sin(4*pi*t)+5*cos(6*pi*t);g=fft(x,N);y=abs(g)/100;figure(4):plot(0:2*pi/N:2*pi*(N-1)/N,y);grid;ts=0.01;N=150;t=0:ts:(N-1)*ts;x=2*sin(4*pi*t)+5*cos(6*pi*t);g=fft(x,N);y=abs(g)/100;figure(5):plot(0:2*pi/N:2*pi*(N-1)/N,y);grid;实验八1%冲激响应 clear;b=1,3;a=1,3,2;sys=tf(b,a);impulse(sys);结果:%求零输入响应 A=1,3;0,-2;B=1;2;Q=ABQ = 4-1 clearB=1,3;A=1,3,2;a,b,c,d=tf2ss(B,A)sys=ss(a,b,c,d);x0=4;-1;initial(sys,x0);grid;a = -3 -2 1 0b = 1 0c = 1 3d = 02.%冲激响应 clear;b=1,3;a=1,2,2;sys=tf(b,a);impulse(sys)%求零输入响应 A=1,3;1,-2;B=1;2;Q=ABQ = 1.6000 -0.2000 clearB=1,3;A=1,2,2;a,b,c,d=tf2ss(B,A)sys=ss(a,b,c,d);x0=1.6;-0.2;initial(sys,x0);grid;a = -2 -2 1 0b = 1 0c = 1 3d = 03.%冲激响应 clear;b=1,3;a=1,2,1;sys=tf(b,a);impulse(sys)%求零输入响应 A=1,3;1,-1;B=1;2;Q=ABQ = 1.7500 -0.2500 clearB=1,3;A=1,2,1;a,b,c,d=tf2ss(B,A)sys=ss(a,b,c,d);x0=1.75;-0.25;initial(sys,x0);grid;a = -2 -1 1 0b = 1 0c = 1 3d = 0二 clear;b=1;a=1,1,1,0;sys=tf(b,a);subplot(2,1,1);impulse(sys);title(冲击响应);subplot(2,1,2);step(sys);title(阶跃响应);t=0:0.01:20;e=sin(t);r=lsim(sys,e,t);figure;subplot(2,1,1);plot(t,e);xlabel(Time);ylabel(A);title(激励信号);subplot(2,1,2);plot(t,r);xlabel(Time);ylabel(A);title(响应信号); 三1. clear;b=1,3;a=1,3,2;t=0:0.08:8;e=exp(-3*t);sys=tf(b,a);lsim(sys,e,t);2. clear;b=1,3;a=1,2,2;t=0:0.08:8;sys=tf(b,a);step(sys)3 clear;b=1,3;a=1,2,1;t=0:0.08:8;e=exp(-2*t);sys=tf(b,a);lsim(sys,e,t);Doc:1. clear;B=1;A=1,1,1;sys=tf(B,A,-1);n=0:200;e=5+cos(0.2*pi*n)+2*sin(0.7*pi*n);r=lsim(sys,e);stem(n,r); 2. clear;B=1,1,1;A=1,-0.5,-0.5;sys=tf(B,A,-1);e=1,zeros(1,100);n=0:100;r=lsim(sys,e);stem(n,r);
展开阅读全文