# Solving a set of simultaneous equations

3 visualizaciones (últimos 30 días)
MarshallSc el 8 de Abr. de 2022
Comentada: Alex Sha el 9 de Abr. de 2022
I have the following set of simultaneous equations that I want to solve. I'm just confused as to what solver is the best choice!
Can it be even solved?
a = 0.5;
sqrt(x1^2 + a*x1*x2 + a*x1*x3 + a*x1*x4) = 30;
sqrt(a*x2*x1 + x2^2 + a*x2*x3 + a*x2*x4) = 33;
sqrt(a*x3*x1 + a*x3*x2 + x3^2 + a*x3*x4) = 25;
sqrt(a*x4*x1 + a*x4*x2 + a*x4*x3 + x4^2) = 10;
Thank you!
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Alex Sha el 9 de Abr. de 2022
There will be multi-solution if no range limition:
No. x1 x2 x3 x4
1 -27.5584616528484 -31.4642304277135 -21.2013312551081 42.4667927458073
2 27.5584616528484 31.4642304277135 21.2013312551081 -42.4667927458073
3 21.092393187031 24.5327728282962 15.6460319211707 2.9752314576261
4 -35.124387658461 55.4211403974195 -28.2016268231437 -8.21718324886969
5 35.124387658461 -55.4211403974195 28.2016268231437 8.21718324886969
6 46.8115886629648 -42.6760633957222 -31.4217676113028 18.926670615613
7 -39.7163903825374 49.5555904803269 -32.6637611270595 17.2196122200305
8 39.7163903825374 -49.5555904803269 32.6637611270595 -17.2196122200305
9 -46.8115886629648 42.6760633957222 31.4217676113028 -18.926670615613
10 31.8811243735484 35.9706867855451 -49.7196043306907 6.44640901641614
11 -31.8811243735484 -35.9706867855451 49.7196043306907 -6.44640901641614
12 36.4849054651774 40.6839971426023 -42.3597267431898 -21.95861020684
13 -36.4849054651774 -40.6839971426023 42.3597267431898 21.95861020684
14 53.1637277627363 -38.0038803965751 -26.9964048344445 -7.46949936450619
15 -53.1637277627363 38.0038803965751 26.9964048344445 7.46949936450619

Iniciar sesión para comentar.

### Respuesta aceptada

Torsten el 8 de Abr. de 2022
a = 0.5;
fun =@(x1,x2,x3,x4) [x1^2 + a*x1*x2 + a*x1*x3 + a*x1*x4 - 30^2;...
a*x2*x1 + x2^2 + a*x2*x3 + a*x2*x4 - 33^2;...
a*x3*x1 + a*x3*x2 + x3^2 + a*x3*x4 - 25^2;...
a*x4*x1 + a*x4*x2 + a*x4*x3 + x4^2 - 10^2];
x = fsolve(@(x)fun(x(1),x(2),x(3),x(4)),[1 1 1 1])
fun(x(1),x(2),x(3),x(4))
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by