comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » singular value decompostion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
singular value decompostion [message #16035] Thu, 01 July 1999 00:00 Go to previous message
Dave Bazell is currently offline  Dave Bazell
Messages: 2
Registered: July 1999
Junior Member
I am trying to use the IDL routine SVDC to do principal component
analysis. In order to understand SVD better I was doing an example I
found online. However, the IDL SVD routine gives me different results
than the online example.

x = [[1,2],[3,4],[5,6],[7,8]]

matlab, which uses linpac gives (to two decimal places):

[U,S,V] = svd(x) where X = U S transpose(V)

U = .15 .82 -.39 -.38
.35 .42 .24 .80
.55 .02 .70 .46
.74 -.38 -.54 .04

S = 14.3 0
0 .62

V = .64 -.77
.77 .64

IDL gives

svdc, x,w,u,v,/column

w = 14.2691 0.626828

u = -0.641423 -0.767187
-0.767187 0.641423
0.00000 0.00000
0.00000 0.00000

v = -0.152483 -0.349918 -0.547354 -0.744789
0.822647 0.421375 0.0201032 -0.381169
0.547723 -0.730297 -0.182574 0.365149
0.00000 0.408249 -0.816496 0.408248

clearly the eigenvalues are the same but the u and v matricies are
exchanged. But what really bothers me is that some values are changed
from positive to negative. And the IDL V does not have the same values
as the MATLAB U.

What am I doing wrong? Even if I leave out the /column in the call to
svdc, I don't get the right answers.

The eigenvalues do not correspond to the eigenvalues returned by the IDL
routine pcomp which calculates principal components. I thought PCA
could be done using SVD but I don't see the correspondence.

Any help would be appreciated.

Thanks.

Dave
bazell@home.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Table Widget sizing
Next Topic: Extra space around widget windows....

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:01:25 PDT 2025

Total time taken to generate the page: 1.59559 seconds