1. ## Matlab orth() function

i have 3 column vectors each 4 numbers/rows high...
to get an orthogonal basis for these in matlab i ahve to combine these into the matrix M and use orth(M) to solve it...my question:

Do i use each vector as a row of the main matrix or do i use the top number of each vector as a row, then the 2nd to top number of each vector as the 2nd row etc..?

I have done it with each vector as a row of the main matrix and the orth function is giving me a lot of decimals:

>> s=[1,1,2,0;-1,2,1,0;1,0,0,1]

s =

1 1 2 0
-1 2 1 0
1 0 0 1

>> orth(s)

ans =

-0.7071 0.5774 -0.4082
-0.7071 -0.5774 0.4082
-0.0000 0.5774 0.8165

Have i done this correct and are the vectors for the basis the vertical columns or the rows of the ans?

2. Originally Posted by deragon999
i have 3 column vectors each 4 numbers/rows high...
to get an orthogonal basis for these in matlab i ahve to combine these into the matrix M and use orth(M) to solve it...my question:

Do i use each vector as a row of the main matrix or do i use the top number of each vector as a row, then the 2nd to top number of each vector as the 2nd row etc..?

I have done it with each vector as a row of the main matrix and the orth function is giving me a lot of decimals:

>> s=[1,1,2,0;-1,2,1,0;1,0,0,1]

s =

1 1 2 0
-1 2 1 0
1 0 0 1

>> orth(s)

ans =

-0.7071 0.5774 -0.4082
-0.7071 -0.5774 0.4082
-0.0000 0.5774 0.8165

Have i done this correct and are the vectors for the basis the vertical columns or the rows of the ans?
A basis of the space spanned by three 4-vectors will be a set of at most 3 4-vectors, you do not have 4-vectors therefore these do not span the space spanned by you three vectors.

Also what does:

Code:
>>help orth
tell you?

RonL