Solved ODE with ode45 to bvp4c

1 view (last 30 days)
Carey n'eville
Carey n'eville on 5 Jan 2021
Commented: Alan Stevens on 5 Jan 2021
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 Comments
J. Alex Lee
J. Alex Lee on 5 Jan 2021
why do you think you want to solve this with bvp4c?
Alan Stevens
Alan Stevens on 5 Jan 2021
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.

Sign in to comment.

Answers (0)

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!