Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
The equation is first-order nonlinear ordinary differential equation. Says to combine Newton-Rhapson and Runge-Kutta methods to solve numerically.

Respuestas (1)

Sergey Kasyanov
Sergey Kasyanov el 27 de En. de 2017
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);

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by