Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Maureen
Maureen el 15 de Oct. de 2023
Editada: Torsten el 15 de Oct. de 2023
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

Respuesta aceptada

Torsten
Torsten el 15 de Oct. de 2023
Movida: Torsten el 15 de Oct. de 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.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by