From Fir2 output to transfer function

11 views (last 30 days)
Giacomo
Giacomo on 12 Aug 2019
Answered: David Wilson on 13 Aug 2019
I have the output of a fir2 function, that is a digital fir filter. I can evaluate it for a given frequency range using freqz, but I need to evaluate it even for the complex variable "s". Therefore, my idea was to transform the fir filter into a continuous transfer function (TF) and, then, evaluate TF for a given complex number using evalfr. But when I do the bode of the transfer function, the response is completely different. Can you help me? (see the code below):
FiltFreq=[0:100];
FiltAmp=cos(FiltFreq/100*pi/2); %target fir response
BF=fir2(50,FiltFreq/FiltFreq(end),FiltAmp); % Fir
RespDig=freqz(BF,1,FiltFreq/FiltFreq(end)*pi); % Fir response
%Comparison target rersponse vs FIR
figure;
plot(FiltFreq,FiltAmp); hold all
plot(FiltFreq,abs(RespDig));
legend('Target response magnitude','Fir response magnitude')
tr_fun=tf(BF,1); % Generation Transfer Function
% Bode plot of the TF that is supposed to represent the FIR above ...
figure;
bode(tr_fun);

Answers (1)

David Wilson
David Wilson on 13 Aug 2019
tr_fun should be a discrete transfer function, (not continuous) say
tr_fun=tf(BF,1,1); % Generate a DISCRETE Transfer Function with Ts =1.

Products


Release

R2010b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!