Fitting a single amplitude sine wave to known peak/trough points

5 views (last 30 days)
Hi again everyone,
I have a vector of data which I want to fit a sine wave to, I want the amplitude of the wave to remain constant though.
I have a script which finds the peaks and troughs in the original data (it is almost a sine wave on it's own) all I need to know is how to get Matlab to create a fixed amplitude sine wave between these known points. Alternatively Matlab could fit the wave to the original data, if that would be better.
I have searched for the answer but I think it's so simple most people don't have a problem. I have the signal processing and statistics toolboxes.
Thanks,
Rod.
An example of the data I have:

Accepted Answer

Right Grievous
Right Grievous on 16 Sep 2013
I solved this problem by taking each location of a peak, using linspace to create the numbers 90-180 (as many numbers as I had time data points) between the peak and the next trough, then I did the same for between the trough and the next peak (180-270) and that peak and the next trough (270-360) and from that trough onto the next peak (360-450).
Then I subtracted 360 from any number over 360 to make all the values range from 0-360 in a correct sin function.

More Answers (0)

Categories

Find more on Measurements and Feature Extraction 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!