how can I plot this differential equation?

I have a complicated differential equation that cannot have explicit solution for m>=3. I am trying to plot the solution so that I can use the data.
%parameters
ed=0.001;
Ev=1000;
n=4000;
m=3;
ed=0.001;
syms y(t)
cond = y(0) == 0;
eq= diff(y,t) == (1/m)*(((Ev*(ed*t-y))/n)^m);

 Respuesta aceptada

Star Strider
Star Strider el 6 de Ag. de 2018
Editada: Star Strider el 6 de Ag. de 2018
Add this to the end of your posted code:
[VF,Subs] = odeToVectorField(eq);
DE = matlabFunction(VF, 'Vars',{t,Y});
[t,y] = ode45(DE, [0 10], 0);
figure(1)
plot(t, y)
grid
EDIT The complete code then becomes:
syms y(t) Y t
%parameters
ed=0.001;
Ev=1000;
n=4000;
m=3;
ed=0.001;
cond = y(0) == 0;
eq = diff(y,t) == (1/m)*(((Ev*(ed*t-y))/n)^m);
[VF,Subs] = odeToVectorField(eq);
DE = matlabFunction(VF, 'Vars',{t,Y});
[t,y] = ode45(DE, [0 10], 0);
figure(1)
plot(t, y)
grid

2 comentarios

Thank you. It's working.
Star Strider
Star Strider el 7 de Ag. de 2018
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by