function [c,f,r2] = regressnpl(x,y)
[a1,a2]=size(x);
a=max(a1,a2);
if a1 == 1
   x=transpose(x);
end
[b1,~]=size(y);
if b1 == 1
   y=transpose(y);
end   
x2=[ones(a,1) x];
c=x2\y;
f=x2*c;
s2=sum((f-y).^2);
stot=sum((y-mean(y)).^2);
r2=1-s2./stot;
