Question: dat=load('co2.dat'); year = dat(:,1); conc = dat(:,2); plot(year,conc,'o'); %Matthew Rainey X = [year ones(size(year))]; % Create the vector z z = X' * conc; %

dat=load('co2.dat'); year = dat(:,1); conc = dat(:,2); plot(year,conc,'o'); %Matthew Rainey X = [year ones(size(year))]; % Create the vector z z = X' * conc; % Calculate matrix S S = X' * X; % Calculate Cholesky decomposition of S U = chol(S); % Solve the triangular systems w = U \ z; c = U' \ w; % Calculate the best-fit line q = year; fit = X * c; % Plot the data and the best-fit line plot(year, conc, 'o', q, fit, 'k', 'linewidth', 2); axis tight; Variable X has an incorrect value. fix Use the vector year to set up the matrix X

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 Mathematics Questions!