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);

 Risposta accettata

Star Strider
Star Strider il 6 Ago 2018
Modificato: Star Strider il 6 Ago 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

Più risposte (0)

Prodotti

Release

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by