In: Mechanical Engineering
Use Matlab and write entier script
Problem 2.
Generate the estimate (linear estimate) for y_est, and plot(x , y_est).
Use “hold on” and plot(x,y) and plot(x,y_est), so that you can see the result of the line and how it fits the data. Does it look like it did a pretty good job?
An estimate of the “residual error” is the sum of the squares of the difference between y and y_est.
This is often denoted as r2.
r2 = sum( (y – y_est) .^2)
or equivalently
r2 = sum( (y – y_est)’ * (y – y_est)’)
What is the residual error for the above problem?
I didn't have data so I am taking arbitrary data. You can try it with the exact data.
Please do rate me and mention doubts, if any, in the comments section.