No BSD License  

Highlights from
Introduction à Matlab (deuxième édition)

from Introduction à Matlab (deuxième édition) by Jean-Thierry
tous les m-fichiers relatifs à la deuxième édition de l'Introduction à Matlab

linfit(x, y)
         function [sol, chi2] = linfit(x, y)
         % LINFIT  minimisation  de sum( (cos(t)*y-sin(t)*x+c).^2)
         %         sol    vecteur t,c 
         %         chi2   sum( (cos(t)*y-sin(t)*x+c).^2) 


         c =cov(x,y);
         t = 0.5.*atan2(2.*c(1,2), c(1,1)-c(2,2)); 
         sol = [t, sin(t).*mean(x)-cos(t).*mean(y)];
         if nargout == 2
           chi2 = sum( (-sin(t).*x+cos(t).*y+sol(2)).^2);
         end;

      

Contact us at files@mathworks.com