the question and problem statement is on the pdf attachment. Tried my best with writing a code for it but I havn't taken matlab in 2 years so I'm extremely fuzzy. Down below is my first function statement but it didn't get included in the main code for some reason.
function CP2SmithTristen sumx=0; sumy=0; x= 1:5 ; y= [4, 7.1, 10.1, 12.5, 14.5]; end
function [a0,a1]=linear_regression(x,y) for i = 1:5 n=length(x); sumx = sumx + x(i); sumy = sumy + y(i); endn = length(x);a1=(n*(sumx*sumy)-sumx*sumy)/((n*sumx^2)-sumx^2);a0=ym-(a1*xm);xm = sumx/nym = sumy/nend
Best Answer