Issues plotting an equation.

2 visualizaciones (últimos 30 días)
Brendan Clark
Brendan Clark el 6 de Abr. de 2021
Editada: VBBV el 6 de Abr. de 2021
I'm having difficultly getting an equation to run for a homework problem I'm working on. I'm hoping someone can help me get the equation to be functional, please don't help me complete the problem beyond that point.
My current code is
clear variables
clc
t=0:.5:5;
w_d=4;
for o=1
x=((10*exp(-o*t))*(cos(w_d*t)))-((0.2*exp(-o*t))*(sin(w_d*t)));
plot(x,t)
end
The error I'm receiving is
Error using *
Incorrect dimensions for matrix multiplication. Check
that the number of columns in the first matrix matches
the number of rows in the second matrix. To perform
elementwise multiplication, use '.*'.
Error in Untitled9 (line 6)
x=((10*exp(-o*t))*(cos(w_d*t)))-((0.2*exp(-o*t))*(sin(w_d*t)));
The homework problem is:
As mentioned previously, I only want help making the equation work. Thank you!

Respuesta aceptada

VBBV
VBBV el 6 de Abr. de 2021
Editada: VBBV el 6 de Abr. de 2021
%f true
clc
t=0:.5:5;
w_d=4;
o=1
x=(10*exp(-o*t).*(cos(w_d*t))-(0.2*exp(-o*t)).*(sin(w_d*t)));
plot(x,t)
Try above with element wise operator

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by