Parse error at "t"

5 visualizaciones (últimos 30 días)
Belle Dionido
Belle Dionido el 4 de Dic. de 2021
Editada: KSSV el 6 de Mzo. de 2022
I am trying to type:
[(d^2)y/d(t^2)] + 3.6(dy/dt) + 3.24y = -10(e^(-1.8t))
but it is saying parse error at 't' on line 5
function dydt = order2(~,y)
dydt = zeros(size(y));
a = 3.6; %coefficient for y; term
b = 3.24; %coefficient for y term
r = -10*e-1.8t; %forcing function
dydt(1) = y(2);
dydt(2) = r -a*y(2) - b*y(1);
  1 comentario
KSSV
KSSV el 4 de Dic. de 2021
Show us full code which you have tried.

Iniciar sesión para comentar.

Respuesta aceptada

Dave B
Dave B el 4 de Dic. de 2021
When you multiply in MATLAB you need a * symbol
r = -10*e-1.8t;
should be
r = -10*e-1.8*t;
  1 comentario
Steven Lord
Steven Lord el 4 de Dic. de 2021
You will also need to define a variable named t in your function by replacing the ~ in the function signature on the first line with t.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by