how can I fit the sine curve for data having several periods?
3 views (last 30 days)
Show older comments
hello. i am new to MATLAB. I have data set for which I have to create a sine curve. The original plot is quite fluctuating so creating a sine curve can lead to a average trend. I have attached the excel file in which original plot is already made. can somebody tell and show how to deal with this data? the period for the sine curve should be one year. thankyou
0 Comments
Answers (1)
Star Strider
on 25 Aug 2015
I have no idea what you want. Your data have one peak at a frequency of about 1, another with a frequency of about 37, and another one at the Nyquist frequency that is not usable.
The code the plot the fft:
[d,s] = xlsread('MUHAMMAD USMAN ARSHAD data.xlsx');
figure(1)
plot(d(:,1), d(:,2))
grid
Ts = mean(diff(d(:,2)));
Fs = 1/Ts;
Fn = Fs/2;
fd = fft(d(:,2));
fd(1) = 0;
fv = linspace(0, 1, length(fd)/2+1)*Fn;
iv = 1:length(fv);
figure(2)
plot(fv, abs(fd(iv)))
grid
7 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!