How to plot curve fitting for this given values ?

I need one curve fitting for this givene set of data and also need the formula for this curve fitting. Please see the given value below. please help me .i plot it in matlab .
x=[821,1038,1161,1368,1730,1934,2188,2768];
y1=[0.44,0.38,0.37,0.32,0.29,0.28,0.25,0.24];
y2=[0.47,0.4,0.38,0.34,0.29,0.29,0.26,0.23];
y3=[0.50,0.41,0.38,0.35,0.30,0.30,0.27,0.24];
y4=[0.51,0.43,0.4,0.39,0.31,0.3,0.28,0.25];
hold on
plot(x,y1,'ro');
plot(x,y2,'ks');
plot(x,y3,'b^');
plot(x,y4,'gd');
hold off

3 commentaires

Cris LaPierre
Cris LaPierre le 13 Mar 2021
Modifié(e) : Cris LaPierre le 13 Mar 2021
Curve fitting requires you have at least an idea of the curve equation you are fitting to. Once you determine that, fitting is rather straight forward.
Look at the fittypes in the fit function, or try to fit the data interactively.
The function below is good enough:
y = p1+p2*x+p3*x^p4
for y1:
Root of Mean Square Error (RMSE): 0.00609474296398704
Sum of Squared Residual: 0.000297167134376556
Correlation Coef. (R): 0.995657107969209
R-Square: 0.991333076649609
Parameter Best Estimate
---------- -------------
p1 -18.2131020720014
p2 9.57653871989359E-5
p3 20.8644903534028
p4 -0.017329560162132
for y2:
Root of Mean Square Error (RMSE): 0.00487132856581337
Sum of Squared Residual: 0.000189838735968874
Correlation Coef. (R): 0.997895473901685
R-Square: 0.995795376833469
Parameter Best Estimate
---------- -------------
p1 0.218720912793765
p2 -1.98776371053174E-5
p3 580.697423913121
p4 -1.14490530579968
for y3:
Root of Mean Square Error (RMSE): 0.00450490478695767
Sum of Squared Residual: 0.000162353337116433
Correlation Coef. (R): 0.998381221912087
R-Square: 0.996765064266671
Parameter Best Estimate
---------- -------------
p1 0.365629108368326
p2 -4.83474991708937E-5
p3 5327591.03780687
p4 -2.56877144493591
for y4:
Root of Mean Square Error (RMSE): 0.00928461654410123
Sum of Squared Residual: 0.000689632834967986
Correlation Coef. (R): 0.99365149000932
R-Square: 0.987343283597743
Parameter Best Estimate
---------- -------------
p1 -0.117602242450941
p2 2.01063745044263E-5
p3 24.7010626607665
p4 -0.552041317148681
Please can you provide me the full matlab code , that will be very helpful to me

Connectez-vous pour commenter.

 Réponse acceptée

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by