equation solving with 3 variables and 4 equations

조회 수: 3 (최근 30일)
Caleb Coombe
Caleb Coombe 2021년 7월 1일
Hello,
I am having trouble with my code depending upon the inputs. Here is the code: clc;
clear;
sx=input('sigma_x=');
sy=input('sigma_y=');
sz=input('sigma_z=');
txy=input('tau_xy=');
tyz=input('tau_yz=');
tzx=input('tau_zx=');
A = [sx txy tzx; txy sy tyz; tzx tyz sz];
[V,D] = eig(A);
[d,ind] = sort(diag(D));
s1 = d(3)
s2 = d(2)
s3 = d(1)
syms i1 m1 n1
eq1 = ((sx - s1)*i1) +(txy*m1) + (tzx*n1)==0;
eq2 = (txy*i1) +((sy-s1)*m1) + (tyz*n1)==0;
eq3 = (tzx*i1) + (tyz*m1) + ((sz-s1)*n1)==0;
eq4 = (i1)^2+(m1)^2+(n1)^2==1;
[i1,m1,n1] = solve(eq1,eq2,eq3,eq4,i1,m1,n1);
i1= vpa(i1(1))
m1= vpa(m1(1))
n1= vpa(n1(1))
When sx=50, sy=100, sz=0, txy=-60, tyz=0, and tzx=0 the code works fine and I find my values for i1, m1, and n1.
When sx=-40, sy=100, sz=30, txy=-50, tyz=12 , and tzx =0 the equations (eq1,eq2,eq3) have these crazy values and I do not understand why.
Please let me know if you know how to resolve this issue!! Thank you for your help.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by