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

 채택된 답변

Star Strider
Star Strider 2018년 8월 6일
편집: Star Strider 2018년 8월 6일

0 개 추천

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

Thank you. It's working.
Star Strider
Star Strider 2018년 8월 7일
As always, my pleasure.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by