Problem 2 Matlab An engineer needs to make a decision between two mathematical m
ID: 2966754 • Letter: P
Question
Problem 2 Matlab An engineer needs to make a decision between two mathematical models to represent a physical system accurately: Model A: y = a0 + a1x + a3x^3 ; model B: y = b0 + b2x^2 + b3x^3 Experiments were performed and the following data were obtained: x 3 4 5 7 8 9 11 12 y 1.6 3.6 4.4 3.4 2.2 2.8 3.8 4.6 (a) MATLAB: Write a program in a script file that uses the general least-squares regression relationship [a] = ([X ]^T [X]^-1 I[X]^T [y] to fit both models to the data, and generate a plot that shows the curve-fitting function curves (both A and B) along with the original data points. Additionally, determine the associated least-squares error E associated with each model. Hint: E = [e]^T [e] (b) CONCLUSION: Which model is more accurate based on the results in (a)?Explanation / Answer
x=[3:5,7:9,11:12];
y=[1.6 3.6 4.4 3.4 2.2 2.8 3.8 4.6];
% Local regression using weighted linear least squares polynomial model
yy=smooth(x,y,'loess' );
yy1=polyfit(x,yy,3);
>> yy1
yy1 =
0.0467 -1.0412 7.1438 -11.4887
since coefficient of model A is more than B, so model A is more correct than B.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.