Ok, Turns out this was a result of not zero padding the signal for the FFT, because the measured data was a 10 second signal sampled at 48kHz, and I was using far too small an FFT size.
Ripple when plotting Transfer Function
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm making measurements of amplifiers using a NI USB-4431 DAQ card. I'm routing a chirp signal from an audio device at 48kHz sample rate, through a Hi-Fidelity analog amplifier, adjusted each time to output 1-5Watts through an 8ohm resistor. I record the chirp output of the amplifier using the DAQ.
I am trying to plot the transfer function between the chirp at 1W and 2W, as a test to validate my code. I expect to see a flat line with some gain. If I can validate that I am plotting this correctly, I can proceed to plot the transfer functions for some other amplifiers that I have measured in a similar way.
This is my code:
load Rec_data
load Chirp_data
fs = 48000;
new_fs = 4800;
nfft = 2048;
%Downsampling with a 13th order Chebychev low-pass filter
%since I am only interested in maximum frequency of 1200 Hz.
%I have tried 2400, but I believe I still have aliasing.
Al_data = decimate(Rec_data,fs/new_fs,13);
Al_Chirp = decimate(Chirp_data,fs/new_fs,13);
% Windowing and FFT.
window1 = hanning(length(Al_data));
window2 = hanning(length(Al_Chirp));
Al_data = window1' .* Al_data;
Al_Chirp = window2' .* Al_Chirp;
otpt = fft(Al_data,nfft);
ipt = fft(Al_Chirp,nfft);
%Transfer function h given by
h = otpt./ipt;
dF = new_fs/nfft;
f = 1:dF:new_fs;
%plotting with a 3rd order median filter (as done in other literature that I am referencing.
plot(f,medfilt1(20*log(abs(h)),3));
The transfer function has a weird ripple in it, that gets exaggerated when I try different settings for nfft, or new_fs. Lower values of nfft give me a very jagged graph too.

0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!