필터 지우기
필터 지우기

error in using the function fsolve to find steady state

조회 수: 4 (최근 30일)
Sara Vasciaveo
Sara Vasciaveo 2021년 2월 23일
답변: Steven Lord 2021년 2월 23일
I am new to programming. I have a mini project on the Lokta- Volterra model. one of the point is to find the steady state of the model. I have used the fsolve function however i receive the error "'fsolve' requires optimisation toolbox" not sure what it mean. the code is as follow can some one help me seeing my mistake?
% Symbolic solution of the steady state equations
syms x1 x2 k1 k2 k3
[x1_ss, x2_ss] = solve(k1*x1 - k2*x1*x2==0, k2*x1*x2 - k3*x2==0 )
% numerical steady states
k1 = 1.1; k2 = 0.001; k3 = 10;
F = @(x) [k1*x(1) - k2*x(1)*x(2), k2*x(1)*x(2) - k3*x(2)];
XO =[15000, 1000];
F_ss = fsolve(F, XO)
thank you
  댓글 수: 3
Sara Vasciaveo
Sara Vasciaveo 2021년 2월 23일
oh so I need to dowloaded?! ok thanks
Sara Vasciaveo
Sara Vasciaveo 2021년 2월 23일
as it seems I have trouble downloading is there another way to achieve the same withouth the toolbox?

댓글을 달려면 로그인하십시오.

답변 (2개)

Alan Stevens
Alan Stevens 2021년 2월 23일
편집: Alan Stevens 2021년 2월 23일
Using the Optimization toolbox to solve these equations seems like using a sledgehammer to crack a nut!
It is clear from the equations that the non-trivial solution is x1 = k3/k2 and x2 = k1/k2.
(There is also the trivial solution x1 = x2 = 0).

Steven Lord
Steven Lord 2021년 2월 23일
Don't try using a numeric solver like fsolve on a function that returns symbolic answers. Use the solve function from Symbolic Math Toolbox, which can operate on symbolic expressions, instead.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by