# Solved ODE with ode45 to bvp4c

조회 수: 3(최근 30일)
Carey n'eville 2021년 1월 5일
댓글: Alan Stevens 2021년 1월 5일
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표시숨기기 이전 댓글 수: 1
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.

댓글을 달려면 로그인하십시오.

R2020b

### Community Treasure Hunt

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

Start Hunting!