solution of a system non linear equations

I have a system of 10 non linear equation. I am tring to solve it by using fsolve.But the problem is that , which gives me one answer. On the other hand Mathematica gives me so many answer among those answer, there is answer I am looking for, which unforunately not given by MATLAB. Perhaps the problem is that tolerance function of fsove is e^{-6}, it may help if I could increase that. Does any one has an idea how to work with it?

2 comentarios

Alex Sha
Alex Sha el 27 de Nov. de 2020
Hi, post out your code in details if possible.
Hassam khan
Hassam khan el 9 de Dic. de 2020
Editada: Hassam khan el 9 de Dic. de 2020
function [F]=myfunction(z)
z1=z(1);
z2=z(2);
z3=z(3);
z4=z(4);
z5=z(5);
z6=z(6);
z7=z(7);
z8=z(8);
z9=z(9);
z10=z(10);
%a=[a(1) a(2) a(3) a(4) a(5) a(6) a(7)]
a=[1.897 7.59 2.23 0.056 1 0.0745 0.0196 0 0 0];
F(1)=(z5^2)/(a(4))+(z6^2)/(a(4))-a(5)^2*a(2)-2*a(5)^2*a(1)+(z3^2)/(2*a(1)+a(2))+(z4^2)/(2*a(1)+a(2))-(2*a(5)*z4*a(2))/(2*a(1)+a(2))+(a(5)^2*a(2)^2)/(2*a(1)+a(2))+(z1^2)/(a(1)+a(6))+a(5)^2*z10^2*a(3);
F(2)=(z5*z7)/(a(4))+(z6*z8)/(a(4))+(z2*z3)/(2*a(1)+a(2))+(z1*z3)/(a(1)+a(6));
F(3)=(z5*z9)/(a(4))+(z3*z7)/(2*a(1)+a(2))-(z4*z8)/(2*a(1)+a(2))+(a(5)*z8*a(2))/(2*a(1)+a(2))+(z1*z5)/(a(1)+a(6));
F(4)=-(z6*z7)/(a(4))+(z5*z8)/(a(4))-(z2*z4)/(2*a(1)+a(2))+(a(5)*z2*a(2))/(2*a(1)+a(2))-(z1*z4)/(a(1)+a(6))-(a(5)*z1*a(1))/(a(1)+a(6))+(a(5)*z1*a(6))/(a(1)+a(6));
F(5)=(z7^2)/(a(4))+(z8^2)/(a(4))+(z2^2)/(2*a(1)+a(2))+(z3^2)/(a(1)+a(6))+(z4^2)/(a(1)+a(6))+(2*a(5)*z4*a(1))/(a(1)+a(6))-(2*a(5)*z4*a(6))/(a(1)+a(6))-(4*a(5)^2*a(6)*a(1))/(a(1)+a(6))+(a(5)^2*z10^2*a(1)*a(3))/(a(1)+a(6))+(a(5)^2*z10^2*a(6)*a(3))/(a(1)+a(6));
F(6)=(z7*z9)/(a(4))+(z2*z7)/(2*a(1)+a(2))+(z3*z5)/(a(1)+a(6))+(z4*z6)/(a(1)+a(6))+(a(5)*z6*a(1))/(a(1)+a(6))+(2*z4*a(6))/(a(1)+a(6))-(a(5)*z6*a(6))/(a(1)+a(6))+(4*a(5)*a(1)*a(6))/(a(1)+a(6));
F(7)=-(z6*z9)/(a(4))-(z4*z7)/(2*a(1)+a(2))-(z3*z8)/(2*a(1)+a(2))+(a(5)*z7*a(2))/(2*a(1)+a(2))-(z1*z6)/(a(1)+a(6))-(2*z1*a(6))/(a(1)+a(6));
F(8)=-(z8*z9)/(a(4))-(z2*z8)/(2*a(1)+a(2))+(z4*z5)/(a(1)+a(6))-(z3*z6)/(a(1)+a(6))+(a(5)*z5*a(1))/(a(1)+a(6))-(2*z3*a(6))/(a(1)+a(6))-(a(5)*z5*a(6))/(a(1)+a(6));
F(9)=a(7)*z10^2*a(5)^2+(z9^2)/(a(4))-a(5)^2*a(4)+(z7^2)/(2*a(1)+a(2))+(z8^2)/(2*a(1)+a(2))+(z5^2)/(a(1)+a(6))+(z6^2)/(a(1)+a(6))+(4*z6*a(6))/(a(1)+a(6))-(4*a(1)*a(6))/(a(1)+a(6));
M=[z1 z3+1i*z4 z5+1i*z6;
z3-1i*z4 z2 z7+1i*z8;
z5-1i*z6 z7-1i*z8 z9];
F(10)=det(M);
here is my code.

Iniciar sesión para comentar.

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 27 de Nov. de 2020

1 voto

If your system of equations has multiple solutions, fsolve() can only give you a single solution based on the initial point x0. One way is to try different initial points until the desired solution is found, but for a high-dimensional system, this approach can be very inefficient.
The other solution is to use symbolic toolbox and use solve() of vpasolve() functions. These functions are capable of finding multiple solutions to a system of equations.

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 27 de Nov. de 2020

Editada:

el 9 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by