0
votes

I am trying to practice with 'fsolve' and have not figured out fully what's been going on with the following code. Can anyone please shed some light on it?

function N=productivity1(N,Ac,Aw)
global Thetac Thetaw tau a b
N=[N(1),N(2)];
N=[N(1)-(Thetac/a)^(1/b)*(1+tau)*Ac; 
  N(2)-(Thetaw/a)^(1/b)*(1+tau)*Aw;
  N(1)+N(2)-1]; %this meant to be a constraint...
end

N0=[0.7,0.3]; %initial guess for x
option=optimset('Display','iter');
result=fsolve(@(N)productivity1(N,Ac0,Aw0),N0,option);

Here are the details:

Ac=2
Aw=20

Ac and Aw should take values such that N(1)+N(2)=1, the starting values of Ac and Aw are not fixed

Fixed parameter values

Thetac=0.6
Thetaw=0.6
tau=0.07
a=0.01
b=0.8

The output is the same as the vector of initial values regardless of value of the above parameters. This is the issue I am facing.

1

1 Answers

0
votes

You need to add diagnostics in your function productivity1 based on the return value exitflag that describes the exit condition of fsolve (http://nl.mathworks.com/help/optim/ug/fsolve.html).