Modeling efflux time from a tank. Equation 11 in the attached document

1 次查看(过去 30 天)
The equation is first-order nonlinear ordinary differential equation. Says to combine Newton-Rhapson and Runge-Kutta methods to solve numerically.

回答(1 个)

Sergey Kasyanov
Sergey Kasyanov 2017-1-27
I think it can be helpful.
You have this function with A, B, C, D are known:
fun = A * (dHdt)^2 + B * (dHdt)^1.75 + C * (dHdt) + D* H;
A=number;
B=number;
C=number;
D=number;
Then you define initial condition:
dHdt0=dHdt0;
H0=H0;
Then you combine solving of function fun(dHdt) and integrate ODE fun(dHdt,H):
%create new function
fun1 = A * (dHdt)^2 + B * (dHdt)^1.75 + C * (dHdt);
%define interval to integrate
T=number;
%define step
dt = 1e-3;
dH = [dHdt0,zeros(1,T/dt)];
H = [H0,zeros(1,T/dt)];
i=2;
%integrate
while i<T/dt+1
%solving of fun(dHdt)
dH(i)=vpasolve(fun1 + H(i-1) * D,dHdt);
%integrate with euler method
H(i)=H(i-1) + dH(i) * dt;
i=i+1;
end
t=[1:i]*dt;
plot(t,H);

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by