Trouble finding equilibria of nonlinear system of equations
14 views (last 30 days)
Show older comments
I am trying to find the equilibria of the system:
- x' = x( 1 - x - y - z) - (x/G_x)
- y' = F_y * [ y * (1 - x - y - z) - (y/G_y) + x * U]
- z' = F_z * [ z * (1 - x - y - z) - (z/G_z) + y * W]
where G_x, G_y, G_z, F_y , F_z, U, and W should be treated like unknown parameters. I have the following in an m-file:
function fcns = eqns(a)
x = a(1);
y = a(2);
z = a(3);
fcns(1) = x( 1 - x - y - z) - (x/G_x);
fcns(2) = F_y * ( y * (1 - x - y - z) - (y/G_y) + x * U);
fcns(3) = F_z * [ z * (1 - x - y - z) - (z/G_z) + y * W];
end
I want to find the equilibria of the system (or zeros) so I use the fsolve(@eqns) function, but I get an error. Could any of you provide me with some assistance?
EDIT: The first error I got was "The input to FSOLVE should be either a structure with valid fields or consist of at least two arguments." So I added the argument x...
fsolve(@eqns, x)
Undefined function or variable 'x'.
I have x defined in the m-file though.
0 Comments
Answers (1)
Star Strider
on 16 Jul 2014
I am guessing that the error is ‘not enough input arguments’ if you are calling fsolve as you mentioned. The fsolve function requires an initial estimate of the parameters as its second input.
If that is not the error you are getting, please post the part of your code that generates the error, and include the complete error message.
2 Comments
Star Strider
on 16 Jul 2014
I don’t know what ‘x’ is either. I suggest you change part of your code to:
a0 = ones(3,1);
[a, fval] = fsolve(@eqns, a0)
and see what that result is. The a vector is x, y, and z as you have defined them, and fval is the value of the function at the solution.
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!