Filter löschen
Filter löschen

inflection point on sum of sinusoids

1 Ansicht (letzte 30 Tage)
Ben
Ben am 3 Mär. 2015
Kommentiert: Ben am 3 Mär. 2015
Hi, I have a problem that may have a neat solution but I'm not certain of the approach. I'd like to find the inflection points of a function which is the sum (superposition) of sinusoids (tidal data).Its formulated like this:
y = A1*sin(w1*t + p1) + A2*sin(w2*t + p2) + ... + An*sin(wn*t + pn)
where A1..An is the component Amplitude; w1..wn is the component frequency; p1..pn is the component phase. And each of these is known.
I think you can find the inflection by finding where the second derivative of y is zero. ie
y'' = 0 = -A1*w1^2*sin(w1*t +p1)+ A1*cos(w1*t +p1) + ..
Is there a fast way to determine the values of t (within a range) for which y'' =0? The timeseries is long (around 1 million points) so recreating the entire timeseries is time consuming.

Akzeptierte Antwort

Andrew Newell
Andrew Newell am 3 Mär. 2015
If you define a vector A = [A1 A2 ... An], and analogous vectors w and p, then in MATLAB
y = sum(A.*sin(w*t+p));
and the second derivative is
ypp = -sum(A.*w.^2.*sin(w*t+p));
(yours is incorrect). Given A, w and p, you can define an anonymous function
f = @(t) -sum(A.*w.^2.*sin(w*t+p));
and then use fzero to find a root, e.g.,
inflection_point = fzero(f,[x0 x1])
for a solution between x0 and x1.
  1 Kommentar
Ben
Ben am 3 Mär. 2015
Thanks Andrew, for the code and for correcting my maths! I was hoping that it would give an array of inflection points but I can easily add a loop as the times between inflections are almost regular. Cheers

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by