I'm trying to plot this:
t=linspace(0,50,50);
plot(t,5*heaviside(t - 7/10)*((9*exp(7/45 - (2.*t)./9))...
./11 - (20.*exp(7/100 - t./10))./11 + 1))
The error is Error using * Inner matrix dimensions must agree.
Where am I missing my dots?

 Respuesta aceptada

Star Strider
Star Strider el 9 de Nov. de 2015
Editada: Star Strider el 9 de Nov. de 2015

0 votos

You need to do element-wise operations, specifically replacing ‘*’ with ‘.*’, ‘/’ with ‘./’, etc. everywhere in an expression involving vectors of the same length.

2 comentarios

David Chau
David Chau el 9 de Nov. de 2015
Does it have to be everywhere or just where the variable matrix appears?
Walter Roberson
Walter Roberson el 9 de Nov. de 2015
You do not need it in the case where you have a scalar constant multiplied by something, or in the case where you are dividing something by a scalar constant, or in any sub-expression that involves strictly scalar constants, such as 7/45 .
plot(t, 5*heaviside(t - 7/10) .* ((9*exp(7/45 - (2*t)/9))/11 - (20*exp(7/100 - t/10))/11 + 1) )

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulation, Tuning, and Visualization en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Nov. de 2015

Comentada:

el 9 de Nov. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by