Not enough input arguments

1 vue (au cours des 30 derniers jours)
Côme Poirier
Côme Poirier le 4 Nov 2021
Commenté : Yongjian Feng le 4 Nov 2021
I've been working on a file in matlab and it says that I have not enough input arguments. It looks strange because I don't see what I should add. Does anybody understands why it shows this ?
Here are the code. Thank you very much for your help.
WHat I get :
Not enough input arguments.
Error in Multi_Solverss/equ (line 7)
values(1)=-ss(7)+ PHI(1)*ss(1)^-VARIOUS(2)*ss(16);
Error in Multi_Solverss (line 45)
rez=fsolve(equ,x0,options);
Here is a solver for a system of non-linear equations, where the equations are dfined by equ that you can find after.
function liste = Multi_Solverss(GAMMA,ALPHA,BETA,PHI,VARIOUS)
N = length(ALPHA);
x0=ones(1,5*N+2);
options=optimset('display','off','MaxFunEvals',3000,'MaxIter',3000);
rez=fsolve(equ,x0,options);
liste = rez;
end
Here is the system equations.
function values = equ(ss)
%Conso
values(1)=-ss(7)+ PHI(1)*ss(1)^-VARIOUS(2)*ss(16);
values(2)=-ss(8)+ PHI(2)*ss(2)^-VARIOUS(2)*ss(16);
values(3)=-ss(9)+ PHI(3)*ss(3)^-VARIOUS(2)*ss(16);
%Labour supply
values(4)=-ss(4)+(ss(10)/ss(17))^VARIOUS(1)*ss(16)^VARIOUS(5);
values(5)=-ss(5)+(ss(11)/ss(17))^VARIOUS(1)*ss(16)^VARIOUS(5);
values(6)=-ss(6)+(ss(12)/ss(17))^VARIOUS(1)*ss(16)^VARIOUS(5);
%L^(1+VARIOUS(1)) = L_A^(1+VARIOUS(1)) + L_B^(1+VARIOUS(1)) + L_C^(1+VARIOUS(1));
values(7)=-ss(17)^(1+VARIOUS(1)) + ss(10)^(1+VARIOUS(1)) + ss(11)^(1+VARIOUS(1)) + ss(12)^(1+VARIOUS(1));
%1 = PHI_A*P_A^(1-VARIOUS(2)) + PHI_B*P_B^(1-VARIOUS(2)) + PHI_C*P_C^(1-VARIOUS(2));
values(8)=-1 + PHI(1)*ss(1)^(1-VARIOUS(2)) + PHI(2)*ss(2)^(1-VARIOUS(2)) + PHI(3)*ss(3)^(1-VARIOUS(2));
%L_A = BETA(1)*(P_A/W_A)*Y_A;
values(9)=-ss(10) + BETA(1)*(ss(1)/ss(4))*ss(13);
%L_B = BETA(2)*(P_B/W_B)*Y_B;
values(10)= -ss(11) + BETA(2)*(ss(2)/ss(5))*ss(14);
%L_C = BETA(3)*(P_C/W_C)*Y_C;
values(11)=-ss(12) + BETA(3)*(ss(3)/ss(6))*ss(15);
% 1 = (VARIOUS(3)*ALPHA(1)/(1-VARIOUS(3)*(1-VARIOUS(4))))^ALPHA(1)*(BETA(1)*ss(1)/ss(3))^(BETA(1))*GAMMA(1)^GAMMA(1)*(GAMMA(4)*ss(1)/ss(2))^GAMMA(4));
values(12)=- 1 + (VARIOUS(3)*ALPHA(1)/(1-VARIOUS(3)*(1-VARIOUS(4))))^ALPHA(1)*(BETA(1)*ss(1)/ss(4))^(BETA(1))*GAMMA(1)^GAMMA(1)*(GAMMA(4)*ss(1)/ss(2))^GAMMA(4)*(GAMMA(7)*ss(1)/ss(3))^(GAMMA(7));
% 1 = (VARIOUS(3)*ALPHA(1)/(1-VARIOUS(3)*(1-VARIOUS(4))))^ALPHA(1)*(BETA(1)*ss(1)/ss(3))^(BETA(1))*GAMMA(1)^GAMMA(1)*(GAMMA(4)*ss(1)/ss(2))^GAMMA(4));
values(13)=- 1 + (VARIOUS(3)*ALPHA(2)/(1-VARIOUS(3)*(1-VARIOUS(4))))^ALPHA(2)*(BETA(2)*ss(2)/ss(5))^(BETA(2))*GAMMA(5)^GAMMA(5)*(GAMMA(2)*ss(2)/ss(1))^GAMMA(2)*(GAMMA(8)*ss(2)/ss(3))^(GAMMA(8));
%Production function for sector C
values(14)= - 1 + (VARIOUS(3)*ALPHA(3)/(1-VARIOUS(3)*(1-VARIOUS(4))))^ALPHA(3)*(BETA(3)*ss(3)/ss(6))^(BETA(3))*GAMMA(9)^GAMMA(9)*(GAMMA(3)*ss(3)/ss(1))^GAMMA(3)*(GAMMA(6)*ss(3)/ss(2))^(GAMMA(6));
% W_A*L_A/(BETA(1)*P_A) = C_A + VARIOUS(4)*(VARIOUS(3)*ALPHA(1)/(1-VARIOUS(3)*(1-VARIOUS(4))))*W_A*L_A/(BETA(1)*P_A)+GAMMA(1)*W_A*L_A/(BETA(1)*P_A)+GAMMA(2)*P_B/P_A*W_B*L_B/(BETA(2)*P_B);
values(15)=- ss(13) + ss(7) + VARIOUS(4)*(VARIOUS(3)*ALPHA(1)/(1-VARIOUS(3)*(1-VARIOUS(4))))*ss(13)+GAMMA(1)*ss(13)+GAMMA(2)*ss(2)/ss(1)*ss(14)+GAMMA(3)*ss(3)/ss(1)*ss(15);
% W_A*L_A/(BETA(1)*P_A) = C_A + VARIOUS(4)*(VARIOUS(3)*ALPHA(1)/(1-VARIOUS(3)*(1-VARIOUS(4))))*W_A*L_A/(BETA(1)*P_A)+GAMMA(1)*W_A*L_A/(BETA(1)*P_A)+GAMMA(2)*P_B/P_A*W_B*L_B/(BETA(2)*P_B);
values(16)=- ss(14) + ss(8) + VARIOUS(4)*(VARIOUS(3)*ALPHA(2)/(1-VARIOUS(3)*(1-VARIOUS(4))))*ss(14)+GAMMA(5)*ss(14)+GAMMA(4)*ss(1)/ss(2)*ss(13)+GAMMA(6)*ss(3)/ss(2)*ss(15);
% Resource constraint for sector C
values(17)=- ss(15) + ss(9) + VARIOUS(4)*(VARIOUS(3)*ALPHA(3)/(1-VARIOUS(3)*(1-VARIOUS(4))))*ss(15)+GAMMA(9)*ss(15)+GAMMA(7)*ss(1)/ss(3)*ss(13)+GAMMA(8)*ss(2)/ss(3)*ss(14);
end

Réponse acceptée

Yongjian Feng
Yongjian Feng le 4 Nov 2021
Maybe you need to pass PHI and VARIOUS into you equ function as well?
  8 commentaires
Côme Poirier
Côme Poirier le 4 Nov 2021
Thanks so much ! It works now ! Thank you !
Yongjian Feng
Yongjian Feng le 4 Nov 2021
Cool. Accept the answer please if it works.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by