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:
Using an expression on all values in a matrix

Subject: Using an expression on all values in a matrix

From: Ulrik Nash

Date: 3 Sep, 2011 15:20:29

Message: 1 of 3

Hi Everyone,

Suppose I have a matrix A. Now I wish to create a matrix B, where each value in B is the corresponding value in A, but with this value in A being part of an expression.

Let me give an example:

Expression: 2^((cells in A) + 1)

A = [1 2;1 3]

B =[4 8;4 16]

Since B = 2^(A+1) doesn't work, what will?

Regards,

Ulrik.

Subject: Using an expression on all values in a matrix

From: Bruno Luong

Date: 3 Sep, 2011 15:32:11

Message: 2 of 3

>
> Since B = 2^(A+1) doesn't work, what will?
 
2.^(A+1)

Bruno

Subject: Using an expression on all values in a matrix

From: Ulrik Nash

Date: 3 Sep, 2011 15:42:13

Message: 3 of 3

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <j3th9r$pt5$1@newscl01ah.mathworks.com>...
> >
> > Since B = 2^(A+1) doesn't work, what will?
>
> 2.^(A+1)
>
> Bruno

Oh :) Thank you Bruno.

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