I am trying to calculate R^2 value for my data and simulation. I used two different ways.
C = corrcoef(ydata,simulation);
rsq1 = C(1,2).^2;
rsq2 = 1 - norm(ydata-simulation)^2 / norm(ydata-mean(ydata))^2;
They should be the same, but actually, the second one is smaller than the first one. Could anyone tell me what is a possible reason for that? Thanks a lot!