📄 ht5.m
字号:
function ht5(h_axes1,N,w1,w2,up1,up2,up3,b2,c)
n=floor(N);
if b2==1
f=[0 w1 1];
amp=[1 0];
up=[(up1+1) up2];
lo=[((up1+1)-2*up1) -up2];
b=fircls(n,f,amp,up,lo);
[dp,mag,pha,grd,w]=freqz_m(b,[1]);
elseif b2==2;
f=[0 w1 1];
amp=[0 1];
up=[up2 (up3+1)];
lo=[-up2 ((up3+1)-2*up3)];
b=fircls(n,f,amp,up,lo);
[dp,mag,pha,grd,w]=freqz_m(b,[1]);
elseif b2==3
f=[0 w1 w2 1];
amp=[0 1 0];
up=[up1 (up2+1) up3];
lo=[-up1 ((up2+1)-2*up2) -up3];
b=fircls(n,f,amp,up,lo);
[dp,mag,pha,grd,w]=freqz_m(b,[1]);
elseif b2==4
f=[0 w1 w2 1];
amp=[1 0 1];
up=[(1+up1) up2 (1+up3)];
lo=[((1+up1)-2*up1) -up2 ((1+up3)-2*up3)];
b=fircls(n,f,amp,up,lo);
[dp,mag,pha,grd,w]=freqz_m(b,[1]);
end
axes(h_axes1);
cla;
if c==1
plot(w/pi,dp,'b');
axis([0,1,-200,10]);
grid on;
% set(h_axes1,'Color',[1 1 1]);
title('least-squares Magnitude Response');
xlabel('Normalized Frequency(*pi rad/sample)');
ylabel('Magnitude(dB)');
elseif c==2
axes(h_axes1);
cla;
plot(w/pi,pha/pi,'b');
grid on;
title('least-squares phase Response');
xlabel('Frequency(*pi rad/sample)');
ylabel('phase(pi)');
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -