以下程序在Matlab软件中,运行时出现了少许错误,请求高手修改一下,尽快回复!多谢,感激不尽!

2024-12-15 00:33:32
推荐回答(3个)
回答1:

Wp=0.4*pi;%(‘请输入通带截止频率:’)

Ws=0.6*pi;%(‘请输入阻带截止频率:’)

delta1=0.01;%(‘请输入通带容许偏芹手差:’)

delta2=0.001;%(‘请输入阻带容许偏差:’)

Ap=20*log10(2/(1-delta1)-1)%设计要求的通带最大衰减(db)

As=-20*log10(delta2/(delta1+1))%设计要求的阻带最小衰减(db)

delta_w=2*pi/1000;

Wsi=Ws/delta_w+1;Wpi=Wp/delta_w;

f=[Wp/pi,Ws/pi];m=[1,0];dev=[delta1,delta2];

[n,fo,ao,weights]=remezord(f,m,dev); 

h=remez(n,fo,ao,weights);

[H,w]=freqz(h,1,1000,'whole');

H=(H(1:1:501));w=(w(1:1:501));

mag=abs(H);

db=20*log10((mag+eps)/max(mag));

Asd=-max(db(Wsi:1:501));

while Asd

n=n+1;

h=remez(n,fo,ao,weights);

[H,w]=freqz(h,1,1000,'whole');

H=(H(1:1:501))';

w=(w(1:1:501))';mag=abs(H);

db=20*log10((mag+eps)/max(mag));

Asd=-max(db(Wsi:1:501));

end

M=n

h=remez(M,fo,ao,weights);

[H,w]=freqz(h,1,1000,'whole');

H=(H(1:1:501))';w=(w(1:1:501))';mag=abs(H);

db=20*log10((mag+eps)/max(mag));

Apd=-(min(db(1:1:Wp/delta_w+1)))%实际得到的最大通带衰减

Asd=-round(max(db(Wsi:1:501)))%实陪手际得到的最小阻带衰减

subplot(2,1,1);

stem([0:1:M],h);

title('实际的脉冲响应','fontsize',8)

axis([0,M,-0.1,0.5]);

xlabel('n','fontsize',8)

ylabel('h(n)','fontsize',8)

set(gca,'XTickMode','manual','XTick',[0,M])

set(gca,'YTickMode','manual','YTick',[-0.1:0.1:0.5])

subplot(2,1,2);

plot(w/pi,db)

title('以分贝形式表示的幅度响应','芦首嫌fontsize',8);

axis([0,1,-100,10]);

xlabel('frequency(*pi)','fontsize',8);

ylabel('db','fontsize',8);

set(gca,'XTickMode','manual','XTick',[0,0.4,0.6,1])

set(gca,'YTickMode','manual','YTick',[-600])

set(gca,'YTickLableMode','manual','YTickLa-bel',{'60','0'})

grid

回答2:

儿童

回答3:

二十世纪