Sinusoidal fit with fixed points
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Is there a way to fit a sine curve to some data points but hold some of the fitted points at known locations? I'm trying to hold the extrema constant because they are known points but the rest of the fit can be anything.
2 Kommentare
Matt J
am 19 Jan. 2015
The location of the extrema determine everything about a sine curve: frequency, amplitude, and phase. There's nothing left to fit.
Akzeptierte Antwort
Matt J
am 22 Jan. 2015
Bearbeitet: Matt J
am 22 Jan. 2015
If the unknown curve is given by y=F(x,p) where p is the vector of unknown parameters, and x and y are vectors of curve samples, then fmincon could be used to estimate p, with a sufficiently good initial guess p0,
p_fit = fmincon(@(p) norm(F(xdata,p) - ydata)^2, p0, [],[],[],[],[],[],...
@(p) F(xfixed,p)-yfixed, options)
where xfixed and yfixed are the x,y pairs that you want constrained. Then, of course, you get the curve with
y_fit=F(xdata,p_fit);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Fit Postprocessing 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!