solving a parametric system of nonlinear equations

3 visualizzazioni (ultimi 30 giorni)
Hi
I am beginner in Matlab. I have the following system of parametric nonlinear equations written in the attached pdf file. I codded in matlab but there is error while running. I would be glad if someone could help me.
global sigma tau delta theta mu B C r eta
%_parameters of the equations_
theta = .36;
sigma=4;
tau=1.35;
delta=0.025;
r=0.02;
eta=0.05 ;
mu= (1-sigma)*((sigma/(sigma-1))*(tau/theta))^(1-sigma);
B=(1-delta)*eta/(1-eta);
C=eta/(eta-1);
options = optimoptions('fsolve','Display','iter');
x0 = [0,0,0,0,0,0];
x = fsolve(@myfun2,x0,options)
I wrote above an initial guess but it is totally a trivial one. I have no clue about the initial value to use.
Below is the function code
function F= fun(x,sigma,tau, delta,theta,mu,B,C,r,eta)
F(1)=x(1)-1/(x(2))^(1-sigma);
F(2)= x(2) - (int(x(3)^(1-sigma),'w',0,inf))^(1/(1-sigma));
F(3)= x(3)-(sigma/(sigma-1))* tau*(x(4)-delta)/theta;
F(4)=x(4)+1 - (1+r-eta*(1-delta)*(x(6)/x(5)))/(1-eta);
F(5)= (1-eta)/(1+r)- (x(1)*mu*(x(4)+delta)^(-sigma)-tau*x(6)-x(5)/(1+x(4))^2)*B*(x(6)/x(5)^2)- 1/(1+x(4));
F(6)=(1-x(4)-delta)*(1-eta)/(1+r)- (x(1)*mu*(x(4)+delta)^(-sigma)-tau*x(6)-x(5)/(1+x(4))^2)*C*(x(6)/x(5)^2)+1;
end

Risposte (1)

Sarah Mohamed
Sarah Mohamed il 3 Gen 2018
Hello!
'fsolve' expects the function passed as its first input (@fun) to take a single input argument, 'x'. It looks like you would like to pass some additional parameters as well. Take a look at the following documentation page for more assistance on this topic:
You might also find the following discussion helpful:

Categorie

Scopri di più su Systems of Nonlinear Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by