zeros of a multivariable function

12 ビュー (過去 30 日間)
Amir Ahmadi
Amir Ahmadi 2017 年 11 月 10 日
編集済み: Walter Roberson 2017 年 11 月 10 日
Hi
I am beginner in matlab, and I need two find two zeros of the following function.
I do not know how I can write its command, the function is:
syms x1 x2 x3 l a b g
% x1:= x, x2: = y, x3: = z, l: = lambda, a:= alpha, b:= beta, g:= damma
f(x1,x2,x3,l,a,b,g)=[-a*x1 - (x2)^2 - (x3)^2 + a*l,
-(x2) +(x1)*(x2) - b*(x1)*(x3) + g,
x3 + b*x1*x2 + x1*x3]
a = 0.25
b = 4
g = 0.5

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 11 月 10 日
編集済み: Walter Roberson 2017 年 11 月 10 日
syms x1 x2 x3 l
a = 0.25
b = 4
g = 0.5
f = [-a*x1 - (x2)^2 - (x3)^2 + a*l,
-(x2) + (x1)*(x2) - b*(x1)*(x3) + g,
x3 + b*x1*x2 + x1*x3];
sol = solve(f, [x1, x2, x3]);
some_random_value_for_l = 1;
X1 = subs(sol.x1, l, some_random_value_for_l);
X2 = subs(sol.x2, l, some_random_value_for_l);
X3 = subs(sol.x3, l, some_random_value_for_l);
vpa([X1, X2, X3])
Now take any two of the five results. For more results, use a different value for some_random_value_for_l

Star Strider
Star Strider 2017 年 11 月 10 日
Try this (requires the Optimization Toolbox):
syms x1 x2 x3 l a b g
a = 0.25;
b = 4;
g = 0.5;
% x1:= x, x2: = y, x3: = z, l: = lambda, a:= alpha, b:= beta, g:= damma
f(x1,x2,x3)=[(-a*x1 - (x2)^2 - (x3)^2 + a*l), (-(x2) +(x1)*(x2) - b*(x1)*(x3) + g), (x3 + b*x1*x2 + x1*x3)];
ff = matlabFunction(f, 'Vars',{[x1,x2,x3],l});
l = 1; % Supply The Correct Value For ‘l’
s = fsolve(@(in1) ff(in1,l), rand(1,3));

カテゴリ

Help Center および File ExchangeFormula Manipulation and Simplification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by