In: Advanced Math
Numerical Linear Algebra:
Please provide a correct detailed solution!!!
Suppose you have the following data: (0, 1.0000), (0.25, 1.2840), (0.50, 1.6487), (0.75, 2.1170) and (1.00, 2.7183) . Using MATLAB, find a polynomial P (x) of degree 2 that fits the data with the minimal approximation error. Calculate this error. Then sketch these discrete points and the graph of the polynomial P(x) in a figure using MATLAB.
First, plot these values using following code:
x = [0 0.25 0.50 0.75 1];
y = [1 1.2840 1.6487 2.1170 2.7183];
plot(x,y)
---------
Then, in figure menu bar click Tools -> Basic Fitting.
In basic fitting dailog box, do as following screenshot:
After doing these, you've got quadratic equation in your plot as well as its residuals (approx. error).
Also, once you click on save to workspace in basic fitting dialog box - you can access all values in command window.
----------------------------------
I hope you'll find it useful.
Thank You!