Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Matrix Algebra

Subject: Matrix Algebra

From: Bryan

Date: 26 Jun, 2008 20:20:07

Message: 1 of 2

I have some pretty basic matrix operations that I know how
to compute using Simulink, but I have a feeling I'm over-
thinking this and wanted to see if anyone knows of a block
or blocks (as I am fairly new to Simulink) that may be a
better solution.

Here's what I'm trying to do:

I have two matrices. One is (n x p) and the other is (1 x
p). I need to point-wise multiply these two matrices over
each row. So, if I were using matlab, a simple solution
would be:
for a = 1:n
   solution(a,:) = m1(a,:) .* m2;
end

Hopefully I sufficiently defined the problem. Here's my
options as I see it now:

1) I can simply use an embedded MATLAB block.
2) If I create an (n x 1) column vector consisting of all
ones and multiply it by m2, I will get an (n x p) matrix
which looks like [m2;m2; ... m2]. Multiplying m1 by this
new matrix will give me the result I'm looking for.

Using an embedded MATLAB block seems like the easiest way
to do this, but is it the best solution? This model will
be used to generate C code.

Any suggestions or potential problems that I'm overlooking?

Thanks!

Subject: Matrix Algebra

From: Bryan

Date: 26 Jun, 2008 20:31:02

Message: 2 of 2

I couldn't figure out if there's a way to edit my post.

I made a small mistake where I describe my 2nd solution.
The last sentence should read, "POINT-WISE multiplying m1
by this new matrix will give me the result I'm looking
for."

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
matrix Bryan 26 Jun, 2008 16:25:06
algebra Bryan 26 Jun, 2008 16:25:06
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics