Why am I receiving the error not enough input arguments?

Continuing to get the error in line 2 not enough input arguements for the following code:
function[a,v,h]= EngineOne(Fmotor,m,TimeStart,dt,t,TimeEnd)
t=TimeStart:dt:TimeEnd
h=zeros(size(t))
m=413
Fmotor=70
TimeStart=0
dt=1
for i=1:length(t)-1
if t>3
Fmotor=0;
m=370;
end
v(i+1)= v(i)+dvdt(i)*dt
h=v.*t+1./2.*a.*(t).^2
dvdt=Fmotor./m-9.81-(0.00626./m).*sign(v).*(v).^(2)
end

Respuestas (1)

Cris LaPierre
Cris LaPierre el 15 de Mzo. de 2021
Editada: Cris LaPierre el 15 de Mzo. de 2021
This error means you can created a function with n inputs, but you are calling it with <n inputs. To say for certain, you'll have to share the code you are using to call the function. It would also help if you shared the full error message (all the red text).
If you are getting an error in line 2, it might be because you did not provide 6 inputs. The 6th input is TimeEnd. If that variable does not have an assigned value, it could cause an error in line 2.

2 comentarios

TimeEnd does not have an assigned variable in the problem given.
Cris LaPierre
Cris LaPierre el 15 de Mzo. de 2021
Editada: Cris LaPierre el 15 de Mzo. de 2021
Then that explains your problem, because your function is expecting it.

Iniciar sesión para comentar.

Preguntada:

el 15 de Mzo. de 2021

Editada:

el 15 de Mzo. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by