Matlab function freqz gives wrong amplitude in dB
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello guys,
i want to compute und plot the filter amplitude response and want to compare it with the filterDesigner function from Matlab.
For that i use this Code:
fs = 1200; Ts = 1/fs;
filterCoff = Filter1, %% FIR lOWPASS Filter
%% Plot of the amplitude response in db
figure(1);
plot(w/(2*pi*Ts),mag2db(abs(h)));
xlabel('Normalized Frequency (Hz)')
ylabel('Magnitude');
I tried everythink, but i dont get the same solution as the filterDesigner.
Risposte (2)
Star Strider
il 2 Mag 2022
I do not see any call to freqz, or the designed filter, so I cannot test this.
What you are seeing may be a frequency-axis resolution problem. The freqz function has the option of choosing the length of the Fourier transform used to plot the Bode plot as the second (or third argument, depending on how the filter is defined), and I usually choose 2^16 for this. A higher value results in a more accurate plot with increased frequency resoution.
If the highest frequency in the passband is not the first frequency, the freqz function does not always scale the amplitude axis so that the highest amplitude is always 0 dB, so it may seem as though the filter is amplifying even though it is not. The relative amplitudes are nevertheless correct.
For freqz, also using:
set(subplot(2,1,1), 'YLim',[-130 0])
(in this instance) may make the plots more comparable by improving the amplitude resolution.
.
9 Commenti
Star Strider
il 10 Mag 2022
My pleasure.
‘Is this explanation correct?’
Essentially, yes. The difference is in the fft frequency resolution and therefore the plot resolution. The underlying data is the same.
‘For The performance of the digital filter we have to look on the high points of the individual parabolas.’
The entire filter is important with respect to the actual filtered signal. The filter is not linear in the stopband, however the variations do not matter because the stopband frequencies are significantly attenuated.
.
Vedere anche
Categorie
Scopri di più su Filter Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


