hB

function Coef = LowPassHb(Fs,Fpass,Apass,n)

% -- Fs sample frequency

% -- Fpass

% -- Apass(dB)

% -- n stage of the half band fir

fp = Fpass*2/(Fs);

dev = [(10^(Apass/20)-1)/(10^(Apass/20)+1)];

% dev = Apass;

switch nargin

    case 3

        Coef = firhalfband('minorder',fp,dev);

    case 4

        Coef = firhalfband(n,fp);

    otherwise

        error('error');

end

        Coef = Coef';

   

 vpa(Coef,16);

fft_coe = 20*log(abs(fft(Coef,1024)))/log(10);

 

% x_f = [0:(Fs/length(fft_coe)):Fs/2];

% m = fft_coe(1:length(x_f));

% plot(x_f,m),grid

 

fft_shift_coe = fftshift(fft_coe);

x_f = [-Fs/2+(Fs/length(fft_shift_coe)):(Fs/length(fft_shift_coe)):Fs/2];

plot(x_f,fft_shift_coe);grid

原文地址:https://www.cnblogs.com/zhongguo135/p/5579461.html