Clear Filters
Clear Filters

not enough input arguments help in line 6 please explain why.

1 view (last 30 days)
ic = [2.5;0;0;0]; vspan = [0 10];
%[v,x] = ode45(@(v,x)ch6(t,x),vspan,ic);
[v,x] = ode45(@ch6,vspan,ic);
plot(v,x)
function xdot=ch6(v,x)
k = 0.0443;
Cto = 0.3045;
Fao = 2.5;
Ft = x(1)+x(2)+x(3); %%not enough input arguments
Ca = Cto*x(1)/Ft;
ra = -k*Ca;
rb = -ra;
rc = -2*ra;
xdot(1,:) = ra;
xdot(2,:) = rb;
xdot(3,:) = rc;
xdot(4,:) = 1-x(1)/Fao;
end

Accepted Answer

Torsten
Torsten on 15 Oct 2023
Moved: Torsten on 15 Oct 2023
Works (see above).
The list of input arguments to your function in the call to ode45 was wrong.
[v,x] = ode45(@(v,x)ch6(t,x),vspan,ic);
makes no sense since t is undefined.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!