Convert Voltage vs. Time data to frequency domain

20 views (last 30 days)
Hi I have a voltage vs. time data as shown in the graph below. I need to convert this data into frequency domain. I did look up fft but I cant accurately define my sampling frequency, frequency of the signal itself, and the signal's equation. I took this data from oscilloscope set at 50k samples/sec and Bandwidth 500 MHz. Please let me know. Thanks

Answers (3)

Star Strider
Star Strider on 8 Feb 2016
You can verify that the sampling frequency of your signal if 50 kHz by doing a few statistics on it:
Time - ...; % Time Vector
Tsm = mean(diff(Time)); % Mean Sampling Frequency (Seconds)
Tss = std(diff(Time)); % Standard Deviation Of Time Differences
Tsc = Tss/Tsm; % Coefficient of Variation
If ‘Tsc’ is on the order of 1E-3 or less, you can reasonably assume a constant sampling interval.
Your sampling frequency is then:
Fx = 1/Tsm; % Sampling Frequency (Hz);
The R2015a fast Fourier Transform documentation, fft, is likely the most helpful, especially the code between the top two plot images.
A bandwidth of 500 MHz is inappropriate for a sampling frequency of 50 kHz, since your highest resolvable frequency (the Nyquist frequency) is 25 kHz. Your bandwidth (that I assume is a hardware filter) should be set equal to the Nyquist frequency to avoid aliasing.
  3 Comments
Star Strider
Star Strider on 9 Feb 2016
The fft is going to give you the necessary information to plot each sinusoid as a separate frequency, amplitude, and phase.
For each frequency, you model would be:
y = A * sin(2*pi*f*t + phi)
where ‘phi’ is the phase (in radians), and ‘A’ is the amplitude. If you get your data from a one-sided fft, you would multiply each amplitude by 2:
y = 2 * A * sin(2*pi*f*t + phi)
To model your signal, you would then sum these terms in a loop. It would be your choice as to how many sinusiods to use. You would also have to add in the amplitude of the d-c component (the first value of the fft) to your summed sinusoids.
Star Strider
Star Strider on 9 Feb 2016
‘Let me know if you find any concerns.’
I do have concerns. You did not show the code you used to calculate and plot your transformed data.
I would feel better if I knew what you did, since this seems to be your research and I want to do what I can to be certain you’re calculating your data correctly. See the R2015a documentation for fft for a description on how to code it. Particularly note the code between the top two plot figures.

Sign in to comment.


Walter Roberson
Walter Roberson on 8 Feb 2016
If your signal turns out to not be uniformly spaced in time to beyond the margin of error you are willing to live with, then you should use a non-uniform fft.

rogan king
rogan king on 9 Feb 2016
I think I got this now. Here is what I did: I fft my voltage values using fft function and then I was worried about what my x-axis would be. So I looked into the data and counted how many data I had for 1 second. This became my maximum value for frequency. Then my frequency looked like this fx = linspace(0,25,10660) where 10660 was the size returned by fft. It worked out for me. Let me know if you find any concerns. Thanks for all of yours help.

Community Treasure Hunt

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

Start Hunting!