Error in MATLAB Too many input arguments

2 次查看(过去 30 天)
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