How to get a plot?

1 visualización (últimos 30 días)
Sion Nam
Sion Nam el 24 de Oct. de 2020
Editada: Sion Nam el 24 de Oct. de 2020
v=dsolve('D2v=-2*Dv-3*v+4*10*sin(5*pi*t)','v(0)=0','Dv(0)=0','t')
how can i get plot(t,v) ???

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 24 de Oct. de 2020
Editada: Ameer Hamza el 24 de Oct. de 2020
You can use fplot()
syms t v
v = dsolve('D2v=-2*Dv-3*v+4*10*sin(5*pi*t)','v(0)=0','Dv(0)=0','t')
fplot(v)
Also, defining ODEs as string is not recommended. You can define it using symbolic variables as follow
syms v(t)
dv = diff(v, 1);
d2v = diff(v, 2);
eq = d2v == -2*dv-3*v+4*10*sin(5*pi*t);
conds = [v(0) == 0; dv(0)==0];
v = dsolve(eq, conds, t)
fplot(v)
  4 comentarios
Ameer Hamza
Ameer Hamza el 24 de Oct. de 2020
Change fplot() too
fplot(v, [0 2])
Sion Nam
Sion Nam el 24 de Oct. de 2020
GRACIAS

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

Community Treasure Hunt

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

Start Hunting!

Translated by