On Feb 19, 1:41=A0pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> "Serena Frittoli" <xe...@hotmail.com> wrote in message <gnhi7a$jd...@fred=
.mathworks.com>...
> > Thanks to reply
> > There is a problem ...
> > If I find theta from V(1,1) using acos e from V(2,1) using asin ... I g=
et two different values ...
>
> > I =A0have another question:
> > tha matrix V from comand =A0[U,S,V] =3D svd(M) ... what does this matri=
x mean?
> > it is possible that sometime it is [cos sin;sin cos] and other times i=
t is [cos sin; sin cos]...
>
> > I'm very confuse!!!
> > Thanks
>
> =A0 Let's tackle one problem at a time. =A0Suppose you have a vector v =
=3D [vx,vy] and you wish to know the angle between the positive xaxis and =
vector v. =A0Even that question has ambiguities to it. =A0One interpretatio=
n is that it is an angle which lies in the range from 0 to pi regardless of=
whether v lies counterclockwise or clockwise from the positive xaxis. =A0=
This would be the way angles within a triangle would be interpreted. =A0Ano=
ther interpretation is that we must rotate strictly counterclockwise from t=
he positive xaxis until first reaching v. =A0That would produce an angle s=
omewhere between 0 and 2*pi. =A0Yet a third interpretation is to rotate eit=
her counterclockwise or clockwise from the xaxis by no more than pi radian=
s with the counterclockwise direction considered positive and clockwise neg=
ative. =A0This angle would therefore lie between pi and +pi.
>
> =A0 In matlab these three possible angle interpretations are best found b=
y using 'atan2' in the following respective ways:
>
> =A01) angle =3D atan2(abs(vy),vx);
> =A02) angle =3D mod(atan2(vy,vx),2*pi);
> =A03) angle =3D atan2(vy,vx);
>
> The method I gave you earlier is in accordance with the third interpretat=
ion here. =A0You will have to decide which kind of angle it is you are seek=
ing.
>
> =A0 You can also use 'asin' or 'acos' to find these, but they suffer a lo=
ss of accuracy for certain values. =A0Also they require a more complicated =
procedure to produce the correct values in cases 2) and 3), since each func=
tion gives results which span no more than a pi width, whereas these cases =
require a span of 2*pi.
>
> =A0 As to applying this to your eigenvectors, you should be aware that ea=
ch eigenvector from 'eig' is arbitrary as to its sign. =A0Either direction =
can occur and in terms of angles that makes a difference of pi in the angle=
value. =A0Also there is nothing in the documentation of 'eig' that specifi=
es that the largest eigenvalue must come first, so there is some doubt abou=
t which eigenvector you are finding the angle for. =A0It makes a difference=
of pi/2 in the answer.
>
> =A0 Finally there is a large ambiguity which occurs in case both eigenval=
ues are equal. =A0In that event the eigenvectors are absolutely arbitrary a=
s long as they are orthogonal and of unit length. =A0Any angle may occur de=
pending on the vagaries of the programming in 'eig'. =A0This is no fault of=
matlab. =A0It is inherent in the very mathematical definition of eigenvect=
ors.
>
> =A0 As to the 'svd' function, there is a definite relationship between th=
e results given by it and those of 'eig' if you are using Hermitian matrice=
s, as is indeed true in your case. =A0I refer you to the Wikipedia article =
at:
>
> =A0http://en.wikipedia.org/wiki/Singular_value_decomposition
>
> In particular read the section on "Relation to eigenvalue decomposition"
>
> =A0 I suspect that these uncertainties are not what you wanted to hear, b=
ut that is simply the way things are. =A0It just means you have to work har=
der at deciding precisely what it is you want to accomplish.
>
> Roger Stafford
And there's another option:
4. angle=3Dmod(atan2(ux,vy)*180/pi,360);
to give bearing (i.e., degrees clockwise from True North)
