Got Questions? Get Answers.
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:
how to construct an orthogonal matrix

Subject: how to construct an orthogonal matrix

From: yuan

Date: 10 Mar, 2010 03:24:07

Message: 1 of 7

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–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:)

Subject: how to construct an orthogonal matrix

From: Matt J

Date: 10 Mar, 2010 04:00:22

Message: 2 of 7

"yuan " <tianyuan_2003@163.com> wrote in message <hn73cn$aqp$1@fred.mathworks.com>...
> 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–Schmidt process, but i fail because the result is a special matrix in which (n-m) columns are zero.
===============

What makes this a failure?

Subject: how to construct an orthogonal matrix

From: TideMan

Date: 10 Mar, 2010 04:19:32

Message: 3 of 7

On Mar 10, 4:24 pm, "yuan " <tianyuan_2...@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–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:)

R=randn(m,n);
perhaps??

Subject: how to construct an orthogonal matrix

From: yuan

Date: 10 Mar, 2010 04:54:06

Message: 4 of 7


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)

Subject: how to construct an orthogonal matrix

From: Walter Roberson

Date: 10 Mar, 2010 05:09:03

Message: 5 of 7

yuan 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)

M = [eye(5), zeros(5,4)];
c = M';

c' * c

ans =
      1 0 0 0 0
      0 1 0 0 0
      0 0 1 0 0
      0 0 0 1 0
      0 0 0 0 1

Subject: how to construct an orthogonal matrix

From: Brian Borchers

Date: 10 Mar, 2010 05:09:43

Message: 6 of 7

On Mar 9, 8:24 pm, "yuan " <tianyuan_2...@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–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.

Subject: how to construct an orthogonal matrix

From: Greg Heath

Date: 10 Mar, 2010 09:45:53

Message: 7 of 7

 On Mar 9, 11:54 pm, "yuan " <tianyuan_2...@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

Tags for 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