[Scilab-users] Using the Function fsolve

Hermes herozigle at gmail.com
Wed Aug 23 11:41:37 CEST 2017


Hi,
I try to reproduce this function found in the following post:

http://mailinglists.scilab.org/Simulation-of-static-general-equilbiirum-model-td4031213.html#a4031215
<http://mailinglists.scilab.org/Simulation-of-static-general-equilbiirum-model-td4031213.html#a4031215>  

clear;
 function resid=Solve_m(param)

resid(1)=param(5)-(1/((A*((param(2)/param(1))*(alpha/(1-alpha))))^(alpha-1)));
 resid(2)=(param(7)*A*(((param(2)/param(1))*(alpha/(1-alpha)))^alpha))-1;
 resid(3)=(param(8)*B*(((param(2)/param(1))*(beeta/(1-beeta)))^beeta))-1;
 resid(4)=(param(6)*B*(((param(2)/param(1))*(beeta/(1-beeta)))^beeta))-1;
 resid(5)=((param(5)*param(1))+(param(7)*param(2)))-Px;
 resid(6)=((param(6)*param(1))+(param(8)*param(2)))-(Py*(1+t));
 resid(7)=((param(5)*param(3))+(param(6)*param(4)))-L;
 resid(8)=((param(7)*param(3))+(param(8)*param(4)))-S;
 endfunction

 //constants
 A=10;
 B=10;
 t=0.2;
 Px=1;
 Py=1;
 alpha=0.3;
 beeta=0.1;
 L=500;
 S=200;

 sol=fsolve([1,10,1280,1200,0.2,0.06,0.1,0.09],Solve_m);
 disp(sol)
 w=sol(1);
 ws=sol(2);
 X=sol(3);
 Y=sol(4);
 alx=sol(5);
 aly=sol(6);
 asx=sol(7);
 asy=sol(8);


But I get the following message:

exec('C:\Users\hermesr\Documents\Scilab Xcos\fsolve_eje7.sce', -1)
fsolve: exception caught in 'jac' subroutine.
at line    24 of executed file C:\Users\hermesr\Documents\Scilab
Xcos\fsolve_eje7.sce

Solve_m: Wrong size for output argument #1: A matrix of size 1 x 8 expected.

How to solve this problem?
Gracias


















--
View this message in context: http://mailinglists.scilab.org/Using-the-Function-fsolve-tp4036915.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list