Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: intersection of two complex matrices
Date: Wed, 24 Nov 2010 07:33:04 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 31
Message-ID: <icif3g$oah$1@fred.mathworks.com>
References: <icg3d0$41j$1@fred.mathworks.com> <icge43$kc6$1@fred.mathworks.com> <ichu3p$csl$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1290583984 24913 172.30.248.37 (24 Nov 2010 07:33:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 24 Nov 2010 07:33:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:689569

"Frank " <allinone_2003@yahoo.com.hk> wrote in message <ichu3p$csl$1@fred.mathworks.com>...
> Thanks a lot.
> 
> Can you please specify the formula of finding R?
> 

Sure:

% Data
A=rand(4,3)+1i*rand(4,3);
B=rand(4,3)+1i*rand(4,3);

% Engine
QA=orth(A);
QB=orth(B)
N=null([QA QB]);
NA=N(1:size(QA,2),:);
NB=N(size(QA,2)+1:end,:);
R = QA*NA;
c = size(R,2); % rank of span<A> intersects span<B>

% Check with random x
x = rand(c,1);
y = +(A\QA)*NA*x
w = -(B\QB)*NB*x

R*x
A*y
B*w

% Bruno