Hey all I have this equation below and trying to figure out how to get the R^2.
I can't seem to understand what I am doing wrong.
x = 0:0.1:10;
n = 0;
noise = n*rand(1,length(x));
y = 2*x+1+noise;
b = regress(y(:),[ones(size(x(:))),x(:)]);
hline = refline(b(2),b(1));
hline.Color = 'r';
I have looked at different ways in MATLAB but can't seem to understand.