Matlab

Thread Starter

jagjit Sehra

Joined Feb 29, 2008
25
Hi Folks, Got another quick question for you. I am trying to enter the folowing function into MATLAB to get a plot graph. However I am getting the following error. I know its something to do with the size of the arrays, however I dont understand how to get around the problem. Thank you in advance for your pearls of wisdom.

>> t=linspace(0,6);
>> vC= 2*exp(-2*t)+ 4*t*exp(-2*t);
??? Error using ==> mtimes
Inner matrix dimensions must agree.

jag.
 

Thread Starter

jagjit Sehra

Joined Feb 29, 2008
25
Hi Folks,
I have got it to work by replacing each '*' by '.*' apparantly without using the dot MATLAB multiplies the whole matrix by another matrix. But using the dot only multiples elements. Is what I have done correct or have I misunderstood the solution.

Jag.
 

Dave

Joined Nov 17, 2003
6,969
Yes this is right.

The ".*" operator does element-wise multiplication of matrices.

i.e. [2 3 4] .* [3 4 5] = [6 12 20]

Dave
 
Top