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:
Is this function available?

Subject: Is this function available?

From: LeanMean82

Date: 6 Dec, 2008 21:49:00

Message: 1 of 5

Hey Guys,

Quick Question.
I just want to know whether matlab has a function that can create a matrix which is an intersection of column spaces of two original matrices. Such that:

A has 5 column vectors, B has 3 column vectors. A and B share at least two column vectors and therefore creates a matrix C with these two column vectors.

Thanks.

Subject: Is this function available?

From: Roger Stafford

Date: 6 Dec, 2008 22:13:02

Message: 2 of 5

LeanMean82 <nndhawan@ufl.edu> wrote in message <852406.1228600170649.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hey Guys,
>
> Quick Question.
> I just want to know whether matlab has a function that can create a matrix which is an intersection of column spaces of two original matrices. Such that:
>
> A has 5 column vectors, B has 3 column vectors. A and B share at least two column vectors and therefore creates a matrix C with these two column vectors.
>
> Thanks.

  Yes. Use the 'intersect' function with the 'rows' option. (You'll have to do some transposing to make it work.)

Roger Stafford

Subject: Is this function available?

From: David Doria

Date: 6 Dec, 2008 23:03:02

Message: 3 of 5

Roger, I feel like he is talking more about the intersection of the column spaces, not a discrete kind of intersection. Intersect() will just say that two things intersect if they are exactly the same, right? Where the vector spaces intersect in a much more complicated way.

I could be way off...

Dave

Subject: Is this function available?

From: Roger Stafford

Date: 7 Dec, 2008 00:35:03

Message: 4 of 5

"David Doria" <daviddoria@gmail.com> wrote in message <ghf0b6$l55$1@fred.mathworks.com>...
> Roger, I feel like he is talking more about the intersection of the column spaces, not a discrete kind of intersection. Intersect() will just say that two things intersect if they are exactly the same, right? Where the vector spaces intersect in a much more complicated way.
> I could be way off...
> Dave

  Here is a quote from the Matlab 7 Function Reference, Vol. 2: "c = intersect(A, B, 'rows') when A and B are matrices with the same number of columns returns the rows common to both A and B." With a transpose understood, you can read that with the words 'rows' and 'columns' interchanged. Nothing is said about the matrices being the same size, only their respective numbers of columns (which translates to rows with the transpose).

  For example, if

 A = [1 2 3 4 5;6 7 8 9 10;11 12 13 14 15]

and

 B = [5 16 2;10 17 7;15 18 12]

then C could be calculated as

 C = intersect(A',B','rows')' = [2 5;7 10;12 15].

I presume from the OP's description, since A and B share two columns in common, that C should consist of just these two columns.

Roger Stafford

Subject: Is this function available?

From: John D'Errico

Date: 7 Dec, 2008 02:47:01

Message: 5 of 5

"David Doria" <daviddoria@gmail.com> wrote in message <ghf0b6$l55$1@fred.mathworks.com>...
> Roger, I feel like he is talking more about the intersection of the column spaces, not a discrete kind of intersection. Intersect() will just say that two things intersect if they are exactly the same, right? Where the vector spaces intersect in a much more complicated way.
>
> I could be way off...
>
> Dave

I'd guess that Roger is correct here. The original
question uses the phrase "column space", but
then gives an example that is not consistent with
the linear algebraic definition of a column space.
Intersect does what was described.

John

Tags for this Thread

No tags are associated with 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