next up previous contents
Next: bjt Up: Listati Previous: posneg   Contents

minquad

function [ m,n ] = minquad( x,y )

%MINQUAD Interpolazione ai minimi quadrati

 

N=length(x);

 

Ex=sum(x)/N;

Ey=sum(y)/N;

 

Exy=sum(x.*y)/N;

 

Ex2=sum(x.2)/N;

 

Sxy=Exy-Ex*Ey;

 

Sx2=Ex2-Ex2;

 

m=Sxy/Sx2;

n=(Ey*Ex2-Ex*Exy)/Sx2;



2001-10-22