Solved ODE with ode45 to bvp4c

2 次查看(过去 30 天)
Friends hello,
I have code solved with ode45, But how can I solve this problem with bvp4c? I need your help, could you help me please?
The code depends on this problem:
We have a lake which have zero concentration of organic pollutant C0=0mg/L, but there is an inflow to the lake which contain organic pollutant with a concentration Cin=31mg/L , when we measure the concentration of organic pollutant in the lake when t=15day=5475hr
C5475=12mg/L. I guess It should increase to the Cin=31mg/L
Cin= Concentration which is inflow of the system(lake), it is consumed with a rate k=5*(10^-6)
C=concentration of the lake, because of being complete mix system C=Cout.
V=volume of the lake
Q=inflow and ourflow of the lake
Min=total mass flux which also equal to Q*Cin
r=k.Cin*exp(-k*t)^2 which is second order decay reaction term
Actual complete mix system formula:
V*(dC/dt)=((Q*Cin)-(Q*C)-(r*V))
C0=0;
tspan = [0 5475]; %in units of h
[t,C]=ode45(@concentration, tspan, C0);
plot(t,C)
xlabel('time (hr)')
ylabel('Concentration (mg/L)')
function dCdt=concentration(t,C)
k=5E-6; %in units of L/mg/h
A=100*10000; %in units of m^2
h=2.5; %in units of m
V=(A*h)*1000; %in units of L
Q=500000; %in units of L/h
Cin=31; %in units of mg/L
dCdt=((Q*Cin)/V-(Q*C)/V-(k*(Cin*exp(-k*t)^2)));
end
  2 个评论
J. Alex Lee
J. Alex Lee 2021-1-5
why do you think you want to solve this with bvp4c?
Alan Stevens
Alan Stevens 2021-1-5
Looks like you have a flowrate that is about twice the size it should be, or a volume that is about half the size it should be, if you want C(t=5475) to be 12.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Boundary Value Problems 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by