File: bvpfcn.m Line: 1 Column: 23 Invalid use of operator.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Signal Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!