How to generate second order best fit polynomial curve using MATLAB
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dan Mathotaarchchi
am 30 Mai 2017
Kommentiert: Dan Mathotaarchchi
am 1 Jun. 2017
Hi all can anybody tell me how to generate above equation for this x and y data using MATLAB ? x,y coordinates are 100,200 200,500 300,900 400,1400 500,2000
0 Kommentare
Akzeptierte Antwort
Musa
am 30 Mai 2017
Bearbeitet: Musa
am 30 Mai 2017
Dan,
You can do this using poly2
x=[100 200 300 400 500]';
y=[200 500 900 1400 2000]';
ft = fittype( 'poly2' ); % Set up fittype and options.
[fitresult, gof] = fit( x, y, ft ); % Fit model to data.
f=@(x) fitresult.p1*x.^2+fitresult.p2*x+fitresult.p3;
plot(x,y,x,f(x),'o')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression 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!