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

9 visualizaciones (últimos 30 días)
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:

Respuesta aceptada

Right Grievous
Right Grievous el 16 de Sept. de 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.

Más respuestas (0)

Categorías

Más información sobre EEG/MEG/ECoG en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by