freshbird 发表于 2009-3-24 15:45

请教一个MATLAB中的问题

我的MATLAB中没有freqz_m,那如果我想调用,我该怎么在程序中加入啊??
function = freqz_m(b,a);
% Modified version of freqz subroutine
% ------------------------------------
% = freqz_m(b,a);
%db = Relative magnitude in dB computed over 0 to pi radians
% mag = absolute magnitude computed over 0 to pi radians
% pha = Phase response in radians over 0 to pi radians
% grd = Group delay over 0 to pi radians
%   w = 501 frequency samples between 0 to pi radians
%   b = numerator polynomial of H(z)   (for FIR: b=h)
%   a = denominator polynomial of H(z) (for FIR: a=)
%
= freqz(b,a,1000,'whole');
    H = (H(1:1:501))'; w = (w(1:1:501))';
mag = abs(H);
   db = 20*log10((mag+eps)/max(mag));
pha = angle(H);
%pha = unwrap(angle(H));
grd = grpdelay(b,a,w);

freshbird 发表于 2009-3-24 15:49

搞定了!~呵呵
页: [1]
查看完整版本: 请教一个MATLAB中的问题