From: Brian Borchers on
On Mar 9, 8:24 pm, "yuan " <tianyuan_2...(a)163.com> wrote:
> Hi everybody,
>
> I'm stuck with a simple problem about how to construct an orthogonal matrix R, say of size m * n.  Note that here m<n, for example, m = 20, n =100.
>
> I try both SVD and Gram&#8211;Schmidt process, but i fail because the result is a special matrix in which (n-m) columns are zero.
>
> Can anyone help me?
>
> Thanks a lot:)

There is no such thing as a matrix with 20 rows and 100 columns with
all of the columns orthogonal and nonzero. It simply doesn't exist.
Chances are that you've misunderstood the homework problem that you
were assigned.
From: Greg Heath on
On Mar 9, 11:54 pm, "yuan " <tianyuan_2...(a)163.com> wrote:
> thank you for the suggestion.
> The following is my code:
>
> a = rand(20,100);
> c=mgrscho(a); // the Gram-sch process
>
> however c'*c =/= I (identity matrix)

close all, clear all, clc

Ntrials = 1
randn('state',4151941)
for i = 1:Ntrials
A = randn(3,4);

Q1 = orth(A);
Q2 = orth(A');
[Q3 R3] = qr(A);
[Q4 R4] = qr(A');
[Q5 S5 Q6] = svd(A);
[Q7 S7 Q8] = svd(A');

disp('Note the size of Q2')
whos Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8
disp('Note the relationship between Q1 Q5 and Q8')
Q158 = [Q1 Q5 Q8]
disp('Note the relationship between Q2 Q6 and Q7')
Q267 = [Q2 Q6 Q7]
disp('Orthogonality Checks')
errq1orth = max(maxabs(inv(Q1) - Q1.'))
errq2orth = max(maxabs(Q2.'*Q2 - eye(3)))
errq3orth = max(maxabs(inv(Q3) - Q3.'))
errq4orth = max(maxabs(inv(Q4) - Q4.'))
errq5orth = max(maxabs(inv(Q5) - Q5.'))
errq6orth = max(maxabs(inv(Q6) - Q6.'))
errq7orth = max(maxabs(inv(Q7) - Q7.'))
errq8orth = max(maxabs(inv(Q8) - Q8.'))

end

Hope this helps.

Greg