主题:(在线)毕业论文MATLAB问题求助!!
期待高手解决下。小弟这里先谢了啊。
我把源文件给出来,都是书上的啊。不知道是不是软件问题。
每次都通不过。。期待ing~!!!
ws1=0.2*pi;wp1=0.35*pi;
wp2=0.65*pi;ws2=0.8*pi;
As=60;
tr_width=min((wp1-ws1),(ws2-wp2));
M=ceil(11*pi/tr_width)+1
n=[0:1:M-1];
wc1=(ws1+wp2)/2;wc2=(ws2+wp2)/2;
hd=ideal_lp(wc2,M)-ideal_lp(wc1,M);
w_bla=(blackman(M))';
h=hd.*w_bla;
[db,mag,pha,grd,w]=freqz_m(h,[1]);
detal_w=2*pi/1000;
Rp=-min(db(wp1/detal_w+1:1:wp2/detal)) %Actual Passband Ripple
As=-round(max(db(ws2/detal_w+1:1:501))) %Min Stop attenution
%Plots
subplot(1,1,1)
subplot(2,2,1);stem(n,hd);title('Ideal Impulse Response')
axis([0 M-1 -0.4 0.5]);xlabel('n');ylable('hd(n)')
xa=0.*n;
hold on
plot(n,xa,'k');
hold off
subplot(2,2,2);stem(n,w_bla);title('Blackman Window')
axis([0 M-1 0 1.1]);xlabel('n');ylabel('w(n)')
subplot(2,2,3);stem(n,h);title('Actual Impulse Response')
axis([0 M-1 -0.4 0.5]);xlabel('n');ylable('hd(n)')
hold on
plot(n,xa,'k');
hold off
subplot(2,2,4);plot(w/pi,db);title('Manitude Response in dB');grid
axis([0 1 -150 10]);xlabel('frequency in pi units');ylabel('Decibles')
set(gca,'XTickMode','manual','XTick',[0,0.2,0.35,0.65,0.8,1]);
set(gca,'XTickMode','manual','XTick',[-60,0]);
set(gca,'XTickLabelMode','manual','XTickLabel',['60';'0'])
每次都是第四行出错。错误提示如下:
??? Undefined function or variable 'wr1'.
Error in ==> C:\MATLAB6p5\work\s000.m
On line 4 ==> tr_width=min((wp1-wr1),(wp2-wr2));
我把源文件给出来,都是书上的啊。不知道是不是软件问题。
每次都通不过。。期待ing~!!!
ws1=0.2*pi;wp1=0.35*pi;
wp2=0.65*pi;ws2=0.8*pi;
As=60;
tr_width=min((wp1-ws1),(ws2-wp2));
M=ceil(11*pi/tr_width)+1
n=[0:1:M-1];
wc1=(ws1+wp2)/2;wc2=(ws2+wp2)/2;
hd=ideal_lp(wc2,M)-ideal_lp(wc1,M);
w_bla=(blackman(M))';
h=hd.*w_bla;
[db,mag,pha,grd,w]=freqz_m(h,[1]);
detal_w=2*pi/1000;
Rp=-min(db(wp1/detal_w+1:1:wp2/detal)) %Actual Passband Ripple
As=-round(max(db(ws2/detal_w+1:1:501))) %Min Stop attenution
%Plots
subplot(1,1,1)
subplot(2,2,1);stem(n,hd);title('Ideal Impulse Response')
axis([0 M-1 -0.4 0.5]);xlabel('n');ylable('hd(n)')
xa=0.*n;
hold on
plot(n,xa,'k');
hold off
subplot(2,2,2);stem(n,w_bla);title('Blackman Window')
axis([0 M-1 0 1.1]);xlabel('n');ylabel('w(n)')
subplot(2,2,3);stem(n,h);title('Actual Impulse Response')
axis([0 M-1 -0.4 0.5]);xlabel('n');ylable('hd(n)')
hold on
plot(n,xa,'k');
hold off
subplot(2,2,4);plot(w/pi,db);title('Manitude Response in dB');grid
axis([0 1 -150 10]);xlabel('frequency in pi units');ylabel('Decibles')
set(gca,'XTickMode','manual','XTick',[0,0.2,0.35,0.65,0.8,1]);
set(gca,'XTickMode','manual','XTick',[-60,0]);
set(gca,'XTickLabelMode','manual','XTickLabel',['60';'0'])
每次都是第四行出错。错误提示如下:
??? Undefined function or variable 'wr1'.
Error in ==> C:\MATLAB6p5\work\s000.m
On line 4 ==> tr_width=min((wp1-wr1),(wp2-wr2));