I am trying to take the FFT of some data I have in excel. However the results that I am getting do not make sense to me. First, below is the plot that is generated when plotting the FFT:
The first indication to me why this does not appear to be correct is that the frequency is 0. There are two reasons why I think this could be the case (possibly both):
1) My initial conditions are incorrect due to wrong assumptions (i.e sampling period and sampling frequency)
Ts = 600; %Sampling period
Fs = 1/Ts; %Sampling frequency
L = 79; %Length of Signal
S = Data_Set; %Array of doubles
The sampling period was calcuated as I know that each point was recorded after 10 minuets for a total of 79 points. I then converted this into seconds resulting in 600. This is an immediate red flag as now my calculated sampling frequency is almost 0. How do I get around this or how do I need to think about this differnely?
2) Error in my code
L2 = 2^nextpow2(L);
ff = fft(plot_Data,L2);
fff = ff(1:L2/2);
xfft = Fs*(0:L2/2-1)/L2;
plot(xfft,abs(fff));
This is the code that I have written to generate the plot that was posted above. Any insight into my questions above would be much appreciated!

 Réponse acceptée

dpb
dpb le 11 Juin 2020

1 vote

It goes through a complete example including computing the associated frequency vector. If you're sampling at 1/10 min, your frequency will be quite low -- 1/10 min --> 1/600 sec --> 1.67 mHz (that's little "m" milli, not big "M" mega) Hz.
The large component at 0 Hz means you also have a nonzero mean -- that's the DC component.
Subtract the mean(S) from S before doing the FFT to remove it...of course you should always plot and examine the time series first...is it stationary or do you need to detrend as well?
What are you measuring at such a slow sample rate? Trying to do frequency analyses of such slow phenomenon is probably not going to work without days of observations, and may not well then depending on just what you're trying to measure (and how).

4 commentaires

Mitchell Berthelot
Mitchell Berthelot le 11 Juin 2020
Thank you for taking the time to answer my questions. I have a sensor that reads the thickness of a material at a certain degree. I actually get values at 360 degrees, but was looking at one particular degree which only populates every 10 minutes. Is there a threshold where it becomes more reasonable? If I was able to example decrease the sampling period from 600 seconds to 60 seconds or is that still entirely too low.
I will attempt removing the DC component tomorrow, but you mentioned the time series (I am assuming by time series you are referring to the time domain signal) "stationary or do you need to detrend as well?" Could you expound upon that I am not sure I know what you mean.
dpb
dpb le 12 Juin 2020
It's only feasible when you have enough samples to cover the lowest frequency of interest at least a couple times and it ought to be 3-4X to get a decent at all estimate of the power (the statistical uncertainty in the estimate is the same as the estimate for a single observation).
What are you trying to learn by doing FFT on such a process? The time between measurements doesn't seem to be relevant to anything about the process specifically if it is just the time it takes to round-robin sample a bunch of locations.
A PSD only tells you the relative power in the signal (in this case "power" will be proportional to the thickness measurement) at a given frequency -- iow, how often that particular thickness occurs. Unless the sampling is related to the extrusion process or the like, it just doesn't seem that would be a measurement of any physical meaning.
By stationary, it's presumed the process is uniform variance and mean and consistent in the frequency content across the time of the sampling. If only a linear trend prevents the assumption, then detrending can solve some of that by removing the baseline.
Here is my time domain signal that makes up the data_set which have set equal to the variable S:
I do not believe that this would be considered a stationary signal based on what you said and what I have read. Does this mean that is nessary for me to detrend the data points before performing an FFT? Is using a MatLab command such as smoothdata() sufficent?
When you say to subtract the mean from the original signal is this what you are referring too?
S = Data_Set;
avg = mean(Data_Set);
n_S = S - avg;
I am not positive this is correct as my points are now ranging from approximately 0.1 to -0.1.
In regards to my sampling frequency, does it need to match the sampling frequency of my time domain signal? That is the only reason that I am setting my sampling period to 600 resulting in a very low sampling frequency.
I am trying to learn what frequencies are present in the signal in hopes to match them to the frequencies in the other proccess happening before the sensor. The idea is that it would allow me to pinpoint exactly what is affecting the change in thicknesses.
dpb
dpb le 15 Juin 2020
No, that isn't stationary -- there are at least two if not three distinct plateaus and maybe more...
Yes, when you subtract the mean you center the signal. Doesn't matter; the energy is still there everywhere except you've removed DC.
Your sampling frequency is how often you take a measurement -- you know (and can know) nothing about anything faster than that -- if you're trying to measure the process, you have to have some way to collect data that is rapid enough to measure whatever it is that is going on.
Whatever the process, it's not likely this will uncover anything related to mechanical process that you can relate to a given component like a bad bearing or whatever -- those will undoubtedly be frequencies in the 100s to 10s of kHz range that would take that kind of sample rate to isolate.
These kinds of measurements are more akin to what you _might_ be able to track/control with quality control charts and those kinds of methods; particularly if you can control things in the process and observe changes.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Centre d'aide et File Exchange

Produits

Version

R2020a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by