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

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 3월 15일
편집: Cris LaPierre 2021년 3월 15일

0 개 추천

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

TimeEnd does not have an assigned variable in the problem given.
Cris LaPierre
Cris LaPierre 2021년 3월 15일
편집: Cris LaPierre 2021년 3월 15일
Then that explains your problem, because your function is expecting it.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2021년 3월 15일

편집:

2021년 3월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by