zeros of a multivariable function
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (2)
Walter Roberson
le 10 Nov 2017
Modifié(e) : Walter Roberson
le 10 Nov 2017
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
0 commentaires
Star Strider
le 10 Nov 2017
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));
0 commentaires
Voir également
Catégories
En savoir plus sur Formula Manipulation and Simplification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!