how to fit a curve to 3 points automatically?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Guys, I'd like to find an automatic method for fitting y=-x^2 curve to three points x=[12 67 16]; can any one suggest me a matlab code please?
5 Kommentare
Jos (10584)
am 2 Mär. 2016
What are the parameters you want to estimate? Fitting a curve involves finding values for one or more unknown parameters, like finding A and B in the equation Yfit = A*x^2 + B that minimises the overal "distance" between the known values of y and the fitted values Yfit
Akzeptierte Antwort
Torsten
am 3 Mär. 2016
Maybe something like
A=[x1^2 x1 1
x2^2 x2 1
x3^2 x3 1];
rhs=[y1 ; y2 ; y3];
sol=A\b;
func=@(x)sol(1)*x.^2+sol(2)*x+sol(3);
x=x1:0.1:x2;
y=func(x);
plot(x,y)
where (x1,y1), (x2,y2), (x3,y3) are the points in question ?
Best wishes
Torsten.
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Interpolation 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!