equation solving with 3 variables and 4 equations
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Numbers and Precision 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!