File: bvpfcn.m Line: 1 Column: 23 Invalid use of operator.
์กฐํ ์: 1 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
function dydx = ode(y, x)
D = 0.1; % m2/s
U = 1; % m/s
K = 1e-6; % 1/s
dydx = [y(2)*
(U * y(2) + K * y(1)) / D]; % EDITED, parentheses added
end
function dydx = bvp4c(@ode,@bc,solinit); % equation to solve
plot(r.x,r.y(1,:),'--o');
title('chlorine decay')
xlabel('pipe length(m)');
ylabel('Concentration (mg/L)');
function dydx = ode(x,y)
D=0.1; % m2/s
U=1; % m/s
K = 1*e-6; % 1/s
dydx = [y(2);(U*y(2)+k*y(1))/D];
end
function res = bcfcn(ya,yb) %boundary conditions
res = [ya(1)-3 yb(1)-2];
end
function g = guess (x) % initial guess for y and y'
guess = [2;1];
xmesh = linspace(0,1,5);
solinit = bvpinit(xmesh,guess);
Question
I need to solve this ODE D*d^2C/dx^2 - U*dC/dx - KC = 0 using Matlab's BVP4C function. I need to plot C vs x.
my parameters are ๐ท = 0.1 m2 /s, ๐ = 1 m/s, ๐พ = 1๐ธ โ 6 s -1 , ๐ถ๐๐ = 3 mg/L, ๐ถ๐๐ข๐ก = 2 mg/L, ๐ฟ = 1.0 m
๋๊ธ ์: 0
๋ต๋ณ (0๊ฐ)
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Signal Processing์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!