フィルターのクリア

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

1 回表示 (過去 30 日間)
Jennifer Yang
Jennifer Yang 2018 年 7 月 18 日
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 Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by