Adding a known velocity (convection) term to reaction diffusion equation using bvp4c

조회 수: 2 (최근 30일)
I am trying to add a known velocity (10 m/s) to my steady state reaction diffusion equation although I'm a bit confused how to go about doing that.
This is my current code
function simple_steady_state_bvp4c
close all; clear all; clc;
%Diffusion coefficient
D_ij= 1*10^-6;
%Initial concentration at x=0
L0 = 1;
%Total length
x_f = 0.025;
k_1 = 0.25;
solinit = bvpinit(linspace(0,x_f,11),[0.5 0]);
sol = bvp4c(@(x,y)odefcn(x,y,D_ij,k_1),@twobc,solinit);
figure(1)
plot(sol.x,(sol.y(1,:)),'LineWidth',1)
title('Steady State')
xlabel('Distance (\mum)')
ylabel('Concentration (nM)')
axis([0 x_f 0 L0])
function dy = odefcn(x,y,D_ij,k_1)
C_L = y(1);
dC_Ldx = y(2);
R_L = -k_1.*C_L;
dy = zeros(2,1);
dy(1) = dC_Ldx;
dy(2) = (-R_L/D_ij);
end
function res = twobc(ya,yb)
res = [ ya(1)-(L0); yb(2) ];
end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by