Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
The equation is first-order nonlinear ordinary differential equation. Says to combine Newton-Rhapson and Runge-Kutta methods to solve numerically.

Risposte (1)

Sergey Kasyanov
Sergey Kasyanov il 27 Gen 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);

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by