Question: A question on matlab, could you please modify the codes provided and get the answer. I really need some codes for preview, thanks! especially i

A question on matlab, could you please modify the codes provided and get the answer. I really need some codes for preview, thanks!

especially i hope to get the codes about "z, Err".

A question on matlab, could you please modify the codes provided andget the answer. I really need some codes for preview, thanks! especially

hw00Bpractice.mat can be download from there

https://drive.google.com/open?id=1qCAaTPF0sIkyfzx__fJAhvkklcPJuPLh

some of codes provided:

% clear the workspace of old values clear % load the practice data & list variables load hw00Bpractice.mat whos A = [t ones(size(t))]; % redo these lines %M = A; %v=b; % linear solve c = Mv; z = c(1)*t+c(2); %keep and do not change the below codes disp('grading variables list: z, Err') % pre-written Plotting section figure(1) clf hold on plot(t,y,'bo') plot(t,z,'r') grid on xlabel('t','fontsize',15) ylabel('y','fontsize',15) title('Least Squares Fit to Random Data','fontsize',15) legend({'Data', 'Fit'},'fontsize',15)

Linear Algebra The following problem will review basic linear algebra operations in Matlab. The code you have been provided performs a linear least squares fit on some noisy data. We will modify it so that it instead performs a quadratic least-squares fit on the same data. You do not need to know the best-fit theory, the worksheet below is designed to be a warm-up to matrix-vector arithmetic in Matlab. Start by running the code hw00Bpractice.m as is. There is information in the screen output and the plot. The code starts by loading the practice data from the file hw00Bpractice.mat; and the whos command gives a list of the data variables. List below all variables and identify them as scalar, vector or matrix quantities (with sizes): Now you are ready to perform the quadratic fit, but note that you will have to be aware of Matlab's element-wise arithmetic. Modify A to be N x 3, with the first column equalling t2, the second column equalling t, and the third column equalling all 1's. Give the new values of M and v. Finally, modify the Matlab vector z so that zj = qt, + c2tj + C3, where cj are the entries ofc-give the best-fit quadratic polynomial Finally, check that your plotted quadratic looks like the best-fit polynomial, and calculate the aver- age squared-error again

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!