File: bvpfcn.m Line: 1 Column: 23 Invalid use of operator.

์กฐํšŒ ์ˆ˜: 1 (์ตœ๊ทผ 30์ผ)
Naveen Krish
Naveen Krish 2022๋…„ 3์›” 18์ผ
ํŽธ์ง‘: Torsten 2022๋…„ 3์›” 18์ผ
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๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Signal Processing์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์ œํ’ˆ


๋ฆด๋ฆฌ์Šค

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by