Plotting FFT when the time steps are not equidistant

조회 수: 11 (최근 30일)
fendertunes
fendertunes 2014년 1월 5일
댓글: fendertunes 2014년 1월 6일
I have a .txt file with time and associated voltages. I am trying to import this in Matlab and look at the frequency response. The problem is the time steps are not equidistant. FFT need equidistant time points. Is there a way I can somehow linspace or extrapolate timesteps to create equidistant points? I have attached the txt file (first column is timestep, second is voltage).
  댓글 수: 3
fendertunes
fendertunes 2014년 1월 5일
Its attached now. Thanks
Image Analyst
Image Analyst 2014년 1월 5일
So, did you try interp1 like I suggested in my answer?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 1월 5일
Yes. Try interp1() to get uniformly spaced samples.
  댓글 수: 3
Image Analyst
Image Analyst 2014년 1월 6일
편집: Image Analyst 2014년 1월 6일
The fft is the amplitude. The magnitude of the fft gives the relative amplitude, energy, power in the various frequencies, I think (Wayne King would know for sure). You can extract the first 100 by taking theFFt(1:100). Then pass into abs() to get the magnitude, or take the real part with real(). Not sure what you're looking for. Do you want to plot 100 singe waves, each with its own amplitude? It would probably be best if Wayne answered this question for you because he knows the fine details about what frequencies the elements correspond to and what the values correspond to. But if I answered your original question, can you mark it as "Accepted"?
fendertunes
fendertunes 2014년 1월 6일
I am looking for first 100 harmonic amplitudes, real part.
I will try - FFTResult(1:100) and seeing if that does it.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2014년 1월 6일
You should be using a Non-Uniform Discrete Fourier Transform. Mathworks does not provide a routine for this, but you can use a Type I nufft from the File Exchange contribution http://www.mathworks.com/matlabcentral/fileexchange/25135-nufft-nfft-usfft

Community Treasure Hunt

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

Start Hunting!

Translated by