Asked by Lalit Patil
on 26 Nov 2012

I have a Three parameters Xi,Yi,Zi.. and I am finding a SVD of them..

A=[Xi,Yi,Zi,ones(length(Xi),1)];

[U,S,V]=svd(A);

ss=diag(S);

i=find(ss==min(ss));

coeff=V(:,min(i));

coeff=coeff/norm(coeff(1:3),2);

and i am getting four parameters for plane.. the code is ok.. but,

is there any method to do SVD without using SVD function..?

*No products are associated with this question.*

Answer by Walter Roberson
on 26 Nov 2012

Source code is at http://www.netlib.org/lapack/double/dgesvd.f

Lalit Patil
on 27 Nov 2012

But , I can't understand what the sequence is of mathematical equations.?

I want That equations or code which can be applied insted of SVD functions..

Walter Roberson
on 27 Nov 2012

**is** the code that is used by MATLAB (though it is not impossible that Mathworks has tweaked the code.) Everything that is documented about **exactly** how MATLAB's SVD function operates is in that source code (when you include the related files for the routines it calls.)

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 6 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54780#comment_113410

can be replaced with

and you will not need to take min(i) on the next line, just i.

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54780#comment_113411

Is there a particular reason for wanting to do SVD without using the SVD function? Knowing your reason might help people select the best alternative for you.

## Lalit Patil (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54780#comment_113413

SVD is almost used at many application, and one of its feature is it gives a best fit..

So, i want to know actually what real procedure happens inside SVD function so that it gives best fit..

I want to know this for my best plane fitting a*X + b*Y + c*Z + d = 0 from so many plane equations..

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54780#comment_113415

http://www.mathworks.com/company/newsletters/articles/professor-svd.html

## Lalit Patil (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54780#comment_113417

This is not that thing which i want..

I want to know that what procedure happened inside SVD matlab function so that U,S,V get generated..?

Actually i want to write code for that..

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/54780#comment_113419

The blog has a bunch of links.