Confirming Correct Results and Y-Axis of FFT
8 views (last 30 days)
Show older comments
Mitchell Berthelot
on 18 Jun 2020
Answered: Ajith Krishna Kanduri
on 19 Jun 2020
I am taking the FFT of some data and have two questions: how do I know I am correct and what are the units of my y-axis?
Let us start with question two. Here is my original time domain signal:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/318658/image.png)
From what I have read the y-axis units of your FFT should be the same as your units on your time-domain signal which in my case is millimeters. Now when I take the FFT my results are as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/318661/image.png)
When I look at this data I am puzzled as nothing that I am doing is every 35mm. I know that my frequencies are very small, but that is expected with my appliaciotn. Here is the code that I am using to make this signal:
s = data - mean(data); %Removes DC component
len2 = 2^nextpow2(len); %Changes lentgh of signal
s = fft(s,len2);
s2 = s(1:len2/2);
xfft = Fs*(0:len2/2-1)/len2; %Converts x-axis to Hz
plot(xfft,abs(s2));
I wanted to add that even though I removed the DC compoent I still have a large spize at very close to 0Hz. Is that normal? Now back to my first question, how do I know this is correct? Any insight would be helpful.
0 Comments
Accepted Answer
Ajith Krishna Kanduri
on 19 Jun 2020
Hi,
The results of the absolute value of the output of the fft function (that you have correctly calculated and scaled) are in the same units as the original data vector. If you measured your data in millimeters, the y-axis of the fft output in your code will be in millimeters.
0 Comments
More Answers (0)
See Also
Categories
Find more on Transforms 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!