Question: Guys, Ive a problem in Matlab In part (b) I was asked to let the user to enter n values of xi and yi then
please clearly mention the name of the group partner and his student ID Your program code should be properly commented; your evaluation will include being able to explain your code. . Submission Items: Submit MATLAB source (m) file(s) and snapshot of the output and graph (copied in a single document file) when you run the program foe the conditions mentioned in the questions below. Question 1: [13 points] Note: Do not use MATLAB build-in functions for regression. (a) Write a MATLAB function that accepts n values of x and yi, perform Linear Regression and returns values of r and, the model parameters ao and a1. (b) Write another MATLAB function that accepts n values of xi and y (provided as arrays), checks for Linear, Power and Saturation growth-rate models, and estimate the values of parameters ao and a1 (or a and B, whichever is applicable). In all three methods, the function should use the function developed in part (a) to perform the linear regression part. Plot the data and the three models (one linear and two non-linear) on the same graph (use distinct colors/shades of lines to differentiate) The function should return a number from 1-3 indicating the model with the best fit, its 2, and the estimated values of parameters. Call the function from the command window with the data given below, capture the image of the output showing the returned values, and the graph, and include these in the Word document for submission. x 1 0.75 2 3 4 6 8 8.5 1.2 1.95 2 2.4 2.4 2.7 2.6 [7 points] Write a MATLAR function that accepts (n +1) values of x and y, fits nh order polynomial, evalunte 1 function lao, al , r21-1inearr3 (x, y) 3-1 x= (17x) ; 6-1 n=length (x) ; 8Sumx-sum (x) 9sumy-sum(y) 10Suxy-sum (x.y): 111-1 sumx2-sum (x72) ; 12-1 sumy2-sum (y.*2) ; 13-xmeanssumx 14ymean-sumy 15 17-a0-ymean-(alxmean) 18-a00-1/a0 20-r2r 2 21all-a1/a0; 22y[a00, al1,r2]: 23-disp (y): 24 5end linea Srror Macrix
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
