Question: Lab Exercise 3: Linear Regression Create a function using MATLAB called LinearRegression to perform linear least-squares regression using the following two models 1. Linear model:

Lab Exercise 3: Linear Regression Create a function using MATLAB called "LinearRegression" to perform linear least-squares regression using the following two models 1. Linear model: y-+ajx 2. Exponential model: y = 1e1x (using linearization): In(y)-In () + 1x For the exponential model, y values are replaced with ln(y) in calculating the constants ao and ai, and the constants ,-ead and ,-al The function should take in values of x and y, and solve for the coefficients for both models (ao ai 1 ) and the coefficient of determination (r2) for the linear model only. Use the fprintf0 command to display the uncertainty. For example >> 78.1% of the original uncertainty has been explained by the linear model Use the subplot command to plot each fit, one above the other, on a linear scale. Use a solid line for each model and markers with no line to represent the raw data points for each plot. Label the x and y axes Submit the following through Moodle Your MATLAB (*.m) file of your function A screenshot of your function running. In the shot, please try to capture the command window, workspace showing the inputs, and plots. 1. 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
