![matlab use fitplot to predict y values matlab use fitplot to predict y values](https://www.mathworks.com/help/examples/curvefit/win64/EvaluateSurfaceFitExample_01.png)
In the same example, we can also fit a different type of curve as per our requirement. Output 1 and Output 2 represent the data attributes and the model respectively. This is how our input and output will look like in MATLAB command window:Īs we can see in Output 3, we have obtained a curve that fits our data. C = fit(Acceleration, Displacement, ‘poly2’)
![matlab use fitplot to predict y values matlab use fitplot to predict y values](https://cdn.educba.com/academy/wp-content/uploads/2020/05/Matlab-fplot-7.png)
The data is of various attributes of cars manufactured over the years 1970, 1976, and 1982.
![matlab use fitplot to predict y values matlab use fitplot to predict y values](https://ww2.mathworks.cn/help/stats/gpr_predict_holdout.png)
In this example, we will use the ‘carsmall’ data provided by MATLAB. We will need some data to which we will fit the curve, for our examples, we will use some inbuilt data sets provided by MATLAB like ‘carsmall’ and ‘census’.
#Matlab use fitplot to predict y values how to#
Let us now understand how to fit a curve or a surface to data in MATLAB: