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

조회 수: 9 (최근 30일)
Right Grievous
Right Grievous 2013년 9월 11일
댓글: M.A.G. 2020년 3월 1일
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:

채택된 답변

Right Grievous
Right Grievous 2013년 9월 16일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by