Error in MATLAB Too many input arguments

조회 수: 2 (최근 30일)
DEBASHIS PANDA
DEBASHIS PANDA 2015년 11월 29일
댓글: DEBASHIS PANDA 2015년 11월 29일
Respected sir, While running my programme i am getting error message too many input arguments.I have searched following link "http://cn.mathworks.com/matlabcentral/answers/176195-pernicious-error-too-many-input-arguments"But unable to solve it,This is the subfunctionfunction PT,which is called in main function(the part of main function related to PT is
l1 = PT(m_cp(m),m_di(m),m_o(m),t(m),p_cp(m));
l2 = PT(m_cp(m),m_di(m),m_o(m),(t(m)+(h/2)),p_cp(m));
l3 = PT(m_cp(m),m_di(m),m_o(m),(t(m)+(h/2)),p_cp(m));
l4 = PT(m_cp(m),m_di(m),m_o(m),(t(m)+(h)),p_cp(m));
p_t(m+1) = p_t(m)+((h*(l1+2*l2+2*l3+l4))/6);)
PLz help where is my error
Error using PT
Too many input arguments.
Error in brain (line 45)
l1 = PT(m_cp(m),m_di(m),m_o(m),t(m),p_cp(m));
function [F] = PT(m_cp,p_cp,m_o,t)
r=2074;
gamma=1.667;
v_aft=.13e-3;
v_rg=.00015;
v_chx=.00002;
v_hhx=.00002;
v_t=.00025;
tc=100;
th=300;
%trg=(th-tc)/(log(th/tc));
vo=.13e-3;
vs=.5e-3;
f=2;
tcp=300;
omega=2*pi*f;
trg=((th-tc)/log(th/tc));
v1=r*(m_cp-m_di);
v2=(r*(m_o-m_di)*th)/tc;
v3=(v_rg/trg)+(v_chx/tc)+(v_t/(gamma*tc))+(v_hhx/tc);
v_cp=vo+(0.5*vs*(1+sin(omega*t)));
v_cpdot=vs*pi*f*cos(omega*t);
v4=-gamma/v_cp;
v5=m_cp*r*tcp;
v6=p_cp*v_cpdot;
p_cpdot=(v4*(v5+v6));
v7=(v_aft*p_cpdot)/th;
F=(v1-v2-v7)/v3;

채택된 답변

Geoff Hayes
Geoff Hayes 2015년 11월 29일
Debashis - the error message Too many input arguments is telling you that you are calling a function and trying to pass it more input parameters than it is expecting. Look at the signature for PT
function [F] = PT(m_cp, p_cp, m_o, t)
There are four input parameters. Now look at how you are calling this function
l1 = PT(m_cp(m),m_di(m),m_o(m),t(m),p_cp(m));
You are passing five input parameters and so the error message makes sense.
If I map your variable names to the input parameters it would seem that the second one, m_di, does not belong (the function signature does not include an input with this name) and that the last one p_cp should be the second input. Please correct how you are calling this function and try again.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by