how can I fit the sine curve for data having several periods?

3 views (last 30 days)
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

Answers (1)

Star Strider
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
MUHAMMAD USMAN ARSHAD
MUHAMMAD USMAN ARSHAD on 25 Aug 2015
ok thanks. i get back to you with these answers soon.. i will keep in touch thank you
MUHAMMAD USMAN ARSHAD
MUHAMMAD USMAN ARSHAD on 25 Aug 2015
i will provide you the simplified data.. and post it after doing finding the answers to your question Sir..

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!