Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Maureen
Maureen am 15 Okt. 2023
Bearbeitet: Torsten am 15 Okt. 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

Akzeptierte Antwort

Torsten
Torsten am 15 Okt. 2023
Verschoben: Torsten am 15 Okt. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by