mpfreq.m

来自「里面囊括了基于matlab滤波器设计的各种.m文件」· M 代码 · 共 44 行

M
44
字号
 
% MPFREQ(B,A,color)
%
% This function is used to plot the amplitude response of filter
% or signal. A logarithmic (base 10) scale is used for the Y-axis.
% X-axis is normalized freqency from 0 to 0.5. The color will be
% the one specified in argument. If there is no color specification,
% the color will be white.
%
% See DPLOT

function mpfreq(B,A)

 %[F,W]=freqz(B,A,1000,'whole');
 [F,W]=freqz(B,A,1000);

 W=linspace(0,0.5,1000);
 phase = angle(F);
 F = abs(F);
 %F = dbvalue(F./max(F));
 F = dbvalue(F);
 subplot(2,1,1)
 plot(W,F,'c')
 
 %axis([0,0.5,5,mi
 %==========================================
 % To show the top of the filter
 % V = axis;
 % axis([0,0.5,V(3),V(4)+20]);
 %==========================================

 %==========================================
 % To plot 6dB straight line
 % hold on
 % semilogy(W,0.5012*ones(1,1000),'g');
 % hold off
 %==========================================

 xlabel('Normalized Frequency');
 ylabel('Magnitude(dB)');
 subplot(2,1,2)
 plot(W,phase,'r')
 xlabel('Normalized Frequency');
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?