MATLAB FFT (y-axis values)

Hi all,
I am analysing the noise of a signal using FFT. I am reading the data (time and voltage/amplitude) from a text file. I used the code below to plot the FFT. How can I know that the plot is correct? What is the label for the y-axis? I did search for FFT plots on google and most of them have the y-axis in the thousand range. Why are my y-axis values so low?
Any help would be highly appreciated. Thanks.
fidi = fopen('data.txt', 'rt');
sig = textscan(fidi, '%f%f', 'Delimiter',' ');
t = sig{1};
amplitude = sig{2};
L = length(t);
Ts = mean(diff(t)); % Sampling Time
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
F_sig = fft(amplitude)*2/L; % Fourier Transform (Normalised)
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(F_sig(Iv)))
grid
zoom on

1 Comment

Hi John, just by curiosity, do you know why your signal is spaced every 100 Hz? I see similar spikes in my FFT of the AFM microscopy (signal is voltage vs time as well) and I cannot figure out where are they comming from...
It may be compleatly unrelated, but ...
thanks
Tamara

Sign in to comment.

 Accepted Answer

You don’t say what your signal is, but perhaps the values are low because the amplitude of your signal is low. If you take the standard deviation of your signal, it should have a similar magnitude:
stdev_amplitude = std(amplitude)

6 Comments

Thanks fot the reply. Yes the average peak-to-peak is arround 1.4mV. So is y-axis the magnitude in dB of in volts?
By definition, decibels (dB) is power. To plot the fft of your signal in dB, the plot call becomes:
plot(Fv, 20*log10(abs(F_sig(Iv))))
That should work.
Hi again. If the 20*log10 is not included, what would be the y-axis units please? The equation for decibels is A = 10*log10(P2/P1). So is it power? I have the signal in the time domain. Is there a way to check if the FFT plotting is correct? Thanks.
My pleasure.
If you do not do the decibel conversion, in that code snippet (that I recognise as my programming style, thank you for quoting it), the units are the magnitude of the signal in the original units, so in this instance mV. Squaring it would result in the units being power, µW, and with the decibel conversion, a ratio of signal power to a reference power. The reference power is commonly omitted.
Multiplying the absolute value of the fft result by the factor of 2/L normalises it, so that the amplitude of a pure frequency on the normalised fft would have the same amplitude as the time-domain signal. With a multi-frequency or noisy signal, since the power in the Fourier-transformed signal is equal to the power in the time-domain signal (Parseval’s theorem), the amplitudes of the individual frequency components will be appropriately scaled to equalise the power.
Thanks for the explenation :)
As always, my pleasure.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!