MATLAB: I am struck with this code.. i want to solve the following 7 interdependent equations simultaneously ..please help

nonlinear

I1 = sigx + sigy + sigz ;
eq(1) = sigx*sigy + sigx*sigz + sigy*sigz - 3*(v)^2- I2;
eq(2) = det([sigx v v; v sigy v;v v sigz])- I3;
eq(3) = min(roots([ 1 -I1 I2 -I3]))- r(2);
eq(4) = (sigx - r(2))*l + v*(m+n);
eq(5)= v*(n+l) + (sigy - r(2) )*m;
eq(6) = v*(l+m)+ n*(sigz-r(2));
eq(7)= l^2 + m^2 + n^2 - 1;

Best Answer

Hi udita,
You have seven equations seven unknowns, but I shall include the first non-numbered equation as well so that you have eight equations, eight unknowns including I1 as an unknown. This does not change the basic situation.
Your question makes it sound like there will be a single solution, or a least a small set of solutions, for the variables. However, these equations have some redundancy in expressing the following system:
M = [sigx v v
v sigy v
v v sigz]
M*vec = r*vec
where r is an eigenvalue of M; you are choosing the smallest such eigenvalue, and vec is the corresponding eigenvector. vec has components (l;m;n).
These equations work for any value of v.
In the code below, the first three equations for U1, U2, U3 are true by construction, since v, which could be anything, is provided. It remains to show that the last five equations are satisfied.
sigx = 1.1;
sigy = 2.3;
sigz = 3.7;
v = 1; % pick a value for v
M = [sigx v v;v sigy v;v v sigz];
[eigvecs eigvals] = eig(M,'vector')
[r n] = min(eigvals); % nth eigenvalue is minimum
lmn = eigvecs(:,n); % corresponding eigenvector
l = lmn(1); m = lmn(2); n = lmn(3);
% following three are true by definition
I1 = sigx + sigy + sigz;
I2 = sigx*sigy + sigx*sigz + sigy*sigz - 3*(v)^2;
I3 = det([sigx v v; v sigy v;v v sigz]);
% check last five eqns
min(roots([ 1 -I1 I2 -I3])) - r
v*(m+n) + l*(sigx - r)
v*(n+l) + m*(sigy - r)
v*(l+m) + n*(sigz - r)
l^2 + m^2 + n^2 - 1
ans = -2.2204e-16 ans = -1.1102e-16 ans = 0 ans = -5.5511e-17 ans = -1.1102e-16
The last eqn, stating that the eigenvector is normalized, is provided by the eig function automatically.
You can try this with other values of v (or sigma) and it works.