Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Economy svd with second arg 0 not correction (R2008a)

Subject: Economy svd with second arg 0 not correction (R2008a)

From: spasmous

Date: 4 Apr, 2009 00:40:51

Message: 1 of 3

A=rand(3,4)


[U S V]=svd(A,'econ'); % correct behaviour
size(S)

ans =

     3 3



[U S V]=svd(A,0); % incorrect behaviour
size(S)

ans =

     3 4

Subject: Economy svd with second arg 0 not correction (R2008a)

From: Roger Stafford

Date: 4 Apr, 2009 02:39:02

Message: 2 of 3

spasmous <spasmous@gmail.com> wrote in message <f01a1a1b-6f88-4218-bea9-30a3dee4f9c1@b6g2000pre.googlegroups.com>...
> A=rand(3,4)
> [U S V]=svd(A,'econ'); % correct behaviour
> size(S)
> ans =
> 3 3
>
> [U S V]=svd(A,0); % incorrect behaviour
> size(S)
> ans =
> 3 4

  That's not incorrect, Spasmous! It's doing as advertised in the documentation: "[U,S,V] = svd(X,0) produces the 'economy size' decomposition. If X is m-by-n with m > n, then svd computes only the first n columns of U and S is n-by-n." In this case m is not greater than n so it has no effect and works the same as svd(A).

Roger Stafford

Subject: Economy svd with second arg 0 not correction (R2008a)

From: spasmous2

Date: 4 Apr, 2009 03:49:17

Message: 3 of 3

On Apr 3, 6:39=A0pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> spasmous<spasm...@gmail.com> wrote in message <f01a1a1b-6f88-4218-bea9-30=
a3dee4f...@b6g2000pre.googlegroups.com>...
> > A=3Drand(3,4)
> > [U S V]=3Dsvd(A,'econ'); % correct behaviour
> > size(S)
> > ans =3D
> > =A0 =A0 =A03 =A0 =A0 3
>
> > [U S V]=3Dsvd(A,0); % incorrect behaviour
> > size(S)
> > ans =3D
> > =A0 =A0 =A03 =A0 =A04
>
> =A0 That's not incorrect,Spasmous!

I dont disagree ;) So let me understand - svd(A,0) and svd(A,'econ')
are not the same. I read the documentation and am unclear.

"[U,S,V] =3D svd(X,0) produces the "economy size" decomposition. If X is
m-by-n with m > n, then svd computes only the first n columns of U and
S is n-by-n.

[U,S,V] =3D svd(X,'econ') also produces the "economy size"
decomposition. If X is m-by-n with m >=3D n, it is equivalent to svd(X,
0). For m < n, only the first m columns of V are computed and S is m-
by-m."

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us