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
Get step-by-step solutions from verified subject matter experts
