필터 지우기
필터 지우기

Time based conditional statement

조회 수: 3 (최근 30일)
Lauren
Lauren 2023년 10월 11일
편집: Walter Roberson 2023년 10월 12일
I am in a class based on estuaries and we were told to write a conditional flux statement to track nitrogen concentration.
I want to condition to show 1000 mg N/L for the first 10 hours, and then I want it to drop to zero. I am supposed to enter this as a left boundary condition. Could anyone tell me how to write a code for this condition? Thank you!
This is what that part of my code looks like currently
Boundary conditions
function [pl,ql,pr,qr] = pdex1bc(xl,cl,xr,cr,t)
pl = 1000; % ***
ql = 1; % ***
pr = cr - 0; % ***
qr = 0; % ***
% Concentration (c): pi = ci - Conci; qi = 0 (i = l,r)
% Flux (F): pi = Fi; qi = 1 (i = l,r)

답변 (1개)

Walter Roberson
Walter Roberson 2023년 10월 11일
I have not used the pde functions myself. I have, however, used the ODE functions, and knowing something about those and reading the documentation https://www.mathworks.com/help/matlab/ref/pdepe.html it looks to me as if you should have time-dependent boundary conditions in a single call.
Instead, what you should do is make two calls with two different tspan. The first one would be out to 10 hours, and the second one would start from 10 hours and run to whenever. You would use the outputs of the first call as inputs to the second call. You would have arranged 1000 mg N/L as the value for the first call, but 0 as the value for the second call.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by