Error in ode45; Graphing ODE
显示 更早的评论
I'm trying to graph two ODE, but I keep getting an error.
function dcdt = CODE(t,p)
v1 = 330;
v2 = 170;
cbar = 10;
k = 5.5;
cdcdt = [ p(1).*((p(2)*k+k)/v1);
p(2).* ((k*p(1)-k)-cbar/v2)];
end
t0 = 0;
tfinal = 180;
p0 = [1; 1];
[t,p] = ode45(@CODE, [t0 tfinal],p0);
plot(t,p)
title('Concentrations over time')
xlabel('t')
ylabel('concentration')
legend('C1','C2')
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in concen (line 6)
[t,p] = ode45(@CODE, [t0 tfinal],p0);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

