Solving ODEs with cubic derivative

조회 수: 7 (최근 30일)
Nora Rafael
Nora Rafael 2019년 11월 1일
I have two differential equations I would like to solve simultaneously using ode45, shown below.
The problem I have is that the second differential equation is actually dy^3/dt, i.e. the derivative of y^3 with respect to t. How do I express this?
function dydt=odefcnNY(t,y,D,Cs,rho,r0,Af,N,V)
dydt=zeros(2,1);
dydt(1)=(3*D*Cs/rho*r0^2)*(y(1)/r0)*(1-y(2)/Cs);
dydt(2)=(D*4*pi*r0*N*(1-y(2)/Cs)*(y(1)/r0)-(Af*y(2)/Cs))/V;
end
D=4e-9;
rho=1300;
r0=10.1e-6;
Cs=0.0016;
V=1.5e-6;
W=4.5e-8;
N=W/(4/3*pi*r0^3*rho);
Af=0.7e-6/60;
tspan=[0 75000];
y0=[r0 Cs];
[t,y]=ode45(@(t,y) odefcnNY(t,y,D,Cs,rho,r0,Af,N,V), tspan, y0);
plot(t,y(:,1),'-o',t,y(:,2),'-.')

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by