Question: EE 221 Computing for Engineers Homework #12-Solution Problem #1 a. Download the file named 'data.mat' and store it in your Matlab working directory. The working
EE 221 Computing for Engineers Homework #12-Solution Problem #1 a. Download the file named 'data.mat' and store it in your Matlab working directory. The working directory is shown as follows Name b. command clear. Then load Create a script file where the first command will clear your workspace using the file using the command load('data.mat'). Run the code. You should have three variables (x, vi, y2) in your workspace. Using least residuals method find the parameters ( & B) that fits yi as yihat-ax+ c. a new figure, plot the approximated curve y1 hat and the data y1 on the graph. Make the marker for yl to be 'o' and the Y1 hat to be - Using least residuals method find the parameters ( & n that fits y2 as y2Jat=exp(a) y2 to be 'o and the Y2 hat to be function y2,hat2 using the command polyval) for y2 to be 'o' and the Y2_hat to be . Note that the fourth order e. f. On a new figure, plot the approximated curve y2 hat s Using the command polyfit) approximate y2 using 4th order polynomial. Then evaluate the curve fit h. On a new figure, plot the approximated curve y2_hat 2 an i. Upload the script file via blackboard. and the data y2 on the graph. Make the marker for d the data y2 on the graph. Make the marker polynomial is a better approximation function importfile (fileToRead1) IMPORTFILE (FILETOREAD1) Imports data from the specified file FILETOREAD1: file to read Auto-generated by MATLAB on 02-Dec-2017 19:44:55 Import the file newDatal -load (-mat', fileToRead1): Create new variables in the base workspace from those fields vars fieldnames (newDatal) for i = 1:length (vars) assignin('base', varsfil, newDatal.(vars(i)) end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
