ode inside ode ; coupled ode ?
이전 댓글 표시
Hi,
my ode requires a solution of another ode. The therm diff(sol.y)/diff(sol.x)/sol.y(end) is needed in the second ode.
for example
function dvdt=myfun(t,v,...)
% Calculating the height of the liquid and its derivative
sol = ode45(f,TSPAN,h,OPTIONS,v,v0,uclose,Au,dw);
h_nm1=h_n;
h_n=sol.y(end);
dh=diff(sol.y)./diff(sol.y);
% my ode MOL discretization calculating the concentration of particles
i=1
dvdt=...
i=2:N-1
dvdt=...
i=N
dvdt=...
Two Questions:
I do not need to solve the first ode always from zero. So i could use the old solution as initial conditions and the old time like TSPAN=[told t] ?
The way i am solving it makes me somehow uncomfortable. I am sure there is a better way. Could i solve both odes at once? But still the second one needs the solution of the first one. So it would be better to set them up as coupled ODES ?
I know you could answer those questions with "yes" or "no", but please comment an that.
Moritz
댓글 수: 2
Moritz
2013년 8월 13일
RahulTandon
2015년 6월 30일
Could you please provide the two basic equations, to start with. The approach here is different!
답변 (1개)
Torsten
2015년 6월 30일
Solve the (N+1) ODEs simultaneously in one call to ODE15s:
dv(1)/dt = ...
dv(2)/dt = ...
...
dv(N)/dt = ...
+
dh/dt = ...
Best wishes
Torsten.
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!