Clear Filters
Clear Filters

Curve Fitting for FFT plot

5 views (last 30 days)
nur yusof
nur yusof on 6 Jul 2015
Edited: arun on 6 Jul 2015
Hi all,
I have data from accelerometer(time domain) and convert it to fft. Below is my coding and the plot.
%Clear clc;
%For Sampling Rate 512
c= Ch_512_60mss'; Track2=c(1,1:4096); Track1_X_Resolution=(1/512); Fs = (1/Track1_X_Resolution); L=4096;%16385;
% Sampling frequency t =(0:L-1)*1/Fs;% 0:1/Fs:2;
x = Track2; nfft = 2^nextpow2(L); % Next power of 2 from length of y
% Length of FFT % Take fft, padding with ze X = fft(x,nfft); X = X(1:nfft/2);
% Take the magnitude of fft of x mx = abs(X);
% Frequency vector f = (0:nfft/2-1)*Fs/nfft; % f1=fit(t,f,'fourier8');
% Generate the plot figure(1); plot(t,x); title('Sine Wave Signal'); xlabel('Time (s)'); ylabel('Amplitude'); figure(2); plot(f,mx); title('Power Spectrum of a Sine Wave'); xlabel('Frequency(Hz)'); ylabel('Power');
However I need to do the curve fit to the plot. Can somebody share with me the coding.I don't know how to do it.
Thanks a lot.
  1 Comment
arun
arun on 6 Jul 2015
Edited: arun on 6 Jul 2015
Fitting only "one curve" for this random data may spoil ur upcoming analysis. U shall try piecewise fit even shat is not good for noisy data.

Sign in to comment.

Answers (0)

Categories

Find more on Fourier Analysis and Filtering 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!