freqeuncy complex data convert to FIR filter
5 views (last 30 days)
Show older comments
i have frequency domain data of plate.
i want to convert to this data to FIR filter to model my system. i heard if i want to FIR filter this filter have 2*n +1 tap (n is maximum freqeuncy)
i think i have to use ifft or invfreqz but the detail code can not access in the mathWorks please help me
0 Comments
Accepted Answer
Mathieu NOE
on 25 Jun 2021
hello
here you are my friend !
tried to fit minimum size IIR filter first , then FIR coefficients are equal to impulse response to IIR
data = importdata ('plate_tf.mat');
freq = data.Hz; % frequency
frf = data.com; % FRF complex
% IIR model
Fs = 1e3;
W = linspace(0,pi,length(freq));
ind = find(freq>50 & freq <150); % frequency weighting ; data reliable between 5 and 80 Hz
WT = zeros(size(W));
WT(ind) = 1;
NB = 2;
NA = 2;
[B,A] = invfreqz(frf,W,NB,NA,WT,Fs);
% check bode plots
[H,WW] = freqz(B,A,length(frf));
figure(1),
subplot(2,1,1),plot(freq,20*log10(abs(frf)),'b',freq,20*log10(abs(H)),'r');grid
subplot(2,1,2),plot(freq,180/pi*(angle(frf)),'b',freq,180/pi*(angle(H)),'r');grid
% Impulse response
[FIR,X] = dimpulse(B,A);
samples = length(FIR);
time = 1/Fs*(1:samples);
figure(2),
plot(time,FIR,'r');grid
title('Impulse response (FIR model)')
xlabel('Time (s)');
ylabel('Amplitude')
8 Comments
Mathieu NOE
on 29 Jun 2021
It still can be used if you have data and model FRFs in good match and make sure also your IIR model is stable (using isstable and impulse or step response)
the warning may be due to under or over parametrization; keep in mind to have the right amount of zeroes and poles in your model
More Answers (0)
See Also
Categories
Find more on Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!