How to generate second order best fit polynomial curve using MATLAB

3 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Musa
Musa le 30 Mai 2017
Modifié(e) : Musa le 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')
  1 commentaire
Dan Mathotaarchchi
Dan Mathotaarchchi le 1 Juin 2017
thank you Musa, now i got following problem to be solved. but i couldnt find a source that enables me to coding. do you know how to solve system of equations with successive substitution by coding with MATLAB. this is the problem,
the successive substitution method is expected to applied. .7 equations and 7 unknowns which are p,Q,m,T,z,b,W and W is the final answer , m=5 can be taken as initial guess. W Vs no of iterations to be graphed ?
p = -3.86*m^2+42.45*m+344.00 ;Q = 5*p^2+4.45*p+4.00 ; m = 2*p^2+4.5*p+14.00 + 5*p^2*T^2+4.45*pT+4.00T ; z=T^2(3*p^2+2.45*p+4.00)+ 3*p^2*T^2+1.45*pT+2.00T ; Q=3m(b-T) ; 800=4m(T-b) ; W=z-Q ;

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by