Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please break each problem down so that it is easy to follow, having a hard time grasping the material. PLEASE PERFORM ON MATLAB (with short

image text in transcribed

Please break each problem down so that it is easy to follow, having a hard time grasping the material.

PLEASE PERFORM ON MATLAB (with short explanations in between steps).

It does not help me if you do it without matlab because I need to do it on there. Also, please keep matlab functions basic as possible, we have not learned any shorthands, shortcuts, or any codes that lead to answers so please keep it basic as can be as if anyone can understand what you are saying.

Thank you!!

5. (Regression, 13pt) You have gotten access to a data set. It's in a matrix E, stored in the file hw5-5.mat in the hw5.zip file. (Download the zip file, extract the file. You can try doubleclicking on the mat file to import it, but in many set-ups Microsoft Access will grab it. If that happens, instead start Matlab, and use Open to open the file hw5-5.mat; the new variable E should then be available in Matlab; you can also use the load command to load a file in the shell.) a) [2pt] The data in E has the form (x|y), where y=f(x), for some unknown function f you are trying to reconstruct. Visualize the data in E. (It's important to choose the right plotting function, if you see zig-zag lines, you're doing it wrong.) Include a screenshot of your visualization. b) [6pt] Based on the visualization you suspect that the underlying model for the data is f(x)= ax3+bx+c+dcos(x/10) for unknown parameters a,b,c,d. Use the regression method we saw in class to find the best choices for a,b,c and d. Hint: the main step is to set-up the matrix A with the relevant data. Then solve the corresponding normal equation (use the linsolve shortcut for that, don't create the normal equations explicitly). Don't use any built-in Matlab functionality for regression (other than linsolve). c) [2pt] Add a plot for the function f(x)=ax3+bx+c+dcos(x/10) with the parameters a,b,c, d you found in part b) to your earlier data-plot. Hint: I did an example in class; remember to hold the earlier data plot. Use plot for plotting f, create new array xval (in a similar range as x ), then compute yval based on the formula, and plot f. Hint 2: if your plot looks funny, could be a mixup between x,y and xval,yval. d) [3pt] Part c) shows us whether our model is a good fit visually; we now want to quantify this numerically. The error in your model is yf(x), where y are the observed values, and f(x)= ax3+bx+c+dcos(x/10) is the model you determined in b). We compute the error in three different ways: i) Compute the 1-norm (yf(x)1. This is the total error of your model. Divide by n, the number of rows in D, to get the average error. ii) Compute the 2-norm (yf(x)2. Divide this by n0.5, that is, the square root of n, the number of rows of D. This is the root-mean-square error, the actual error that the regression model minimizes. iii) Compute the infinity-norm (yf(x), this is the worst difference for any data point (this one doesn't need to be averaged, since it's a max)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions