Run the solve command in symbolic math toolbox ?
Mostrar comentarios más antiguos
I want to solve 12 equations containing 12 variables using the solve command but my college doesn't have the symbolic math toolbox. can anyone pls solve these and post the results, i'll be really grateful as my whole project depends on these.
Equations:
1)(x1-xf1)^2+(y1-yf1)^2+(z1-zf1)^2-9^2=0
2)(x2-xf2)^2+(y2-yf2)^2+(z2-zf2)^2-11^2=0
3)(x3-xf3)^2+(y3-yf3)^2+(z3-zf3)^2-10^2=0
4)(x4-xf4)^2+(y4-yf4)^2+(z4-zf4)^2-8^2=0
5)(x1-xp)^2+(y1-yp)^2+(z1-zp)^2-12.065^2=0
6)(x2-xp)^2+(y2-yp)^2+(z2-zp)^2-10.25^2=0
7)(x3-xp)^2+(y3-yp)^2+(z3-zp)^2-10.25^2=0
8)(x4-xp)^2+(y4-yp)^2+(z4-zp)^2-12.065^2=0
9)(x1-x2)^2+(y1-y2)^2+(z1-z2)^2-4.5^2=0
10)(x1-x3)^2+(y1-y3)^2+(z1-z3)^2-4*(4.5^2)=0
11)(x1-x4)^2+(y1-y4)^2+(z1-z4)^2-9*(4.5^2)=0
12)(x3-x2)^2+(y3-y2)^2+(z3-z2)^2-4.5^2=0
I want to find x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4 in terms of the other variables so that i can use them in further calculation.
14 comentarios
Ivan van der Kroon
el 5 de Jun. de 2011
Can you post a working m-file?
Walter Roberson
el 5 de Jun. de 2011
I started this executing in Maple, but it is taking quite a bit of time.
Are there restrictions that can be placed on the variables? For example are they all real-valued? Non-negative?
With a set of equations as large as that, branching through all the real vs complex possibilities takes a long time.
Walter Roberson
el 5 de Jun. de 2011
I ran this for about 4 1/2 hours, but it grew past 2 Gb so I had to kill it.
If there were constraints on the value, the run-time would potentially be much less.
Is the task to find the intersection of several spheres? If so then Roger Stafford has written about the algebra of that several times; the most common answer once past 2 spheres is "you can't satisfy all those constraints simultaneously". It would depend, though, on the geometry of the situation.
Walter Roberson
el 6 de Jun. de 2011
m-file equivalent:
syms x1 x2 x3 x4 y1 y2 y3 y4 z1 z2 z3 x4
syms xf1 xf2 xf3 xf4 yf1 yf2 yf3 yf4 zf1 zf2 zf3 zf4
syms xp yp zp
eq1 = (x1-xf1)^2+(y1-yf1)^2+(z1-zf1)^2-9^2;
eq2 = (x2-xf2)^2+(y2-yf2)^2+(z2-zf2)^2-11^2;
eq3 = (x3-xf3)^2+(y3-yf3)^2+(z3-zf3)^2-10^2;
eq4 = (x4-xf4)^2+(y4-yf4)^2+(z4-zf4)^2-8^2;
eq5 = (x1-xp)^2+(y1-yp)^2+(z1-zp)^2-12.065^2;
eq6 = (x2-xp)^2+(y2-yp)^2+(z2-zp)^2-10.25^2;
eq7 = (x3-xp)^2+(y3-yp)^2+(z3-zp)^2-10.25^2;
eq8 = (x4-xp)^2+(y4-yp)^2+(z4-zp)^2-12.065^2;
eq9 = (x1-x2)^2+(y1-y2)^2+(z1-z2)^2-4.5^2;
eq10 = (x1-x3)^2+(y1-y3)^2+(z1-z3)^2-4*(4.5^2);
eq11 = (x1-x4)^2+(y1-y4)^2+(z1-z4)^2-9*(4.5^2);
eq12 = (x3-x2)^2+(y3-y2)^2+(z3-z2)^2-4.5^2;
sols = solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4);
for K = 1 : length(sols)
fprintf('\nSolution #%d\n\n',K);
sols(K)
end
Sourabh Bajaj
el 6 de Jun. de 2011
Sourabh Bajaj
el 6 de Jun. de 2011
Sourabh Bajaj
el 6 de Jun. de 2011
Walter Roberson
el 6 de Jun. de 2011
"Pls help me with running the simulation" -- I've been running it for the last 12 hours, the last 4 or so hours of which have been constrained to real numbers. There are still a lot of cases to check.
Walter Roberson
el 6 de Jun. de 2011
It was too large for me to run constrained to real numbers.
Even just equations 1, 2, and 9 together are giving the system problems. I recommend that you read Roger Stafford's postings about intersecting spheres.
Sourabh Bajaj
el 6 de Jun. de 2011
Sourabh Bajaj
el 6 de Jun. de 2011
Walter Roberson
el 6 de Jun. de 2011
These are not linear equations. Look at the first term of the first equation: it has x2 on the left side of the multiplication and x2 on the right side of the multiplication. You might have reduced the number of non-linear terms,but it is still non-linear.
I think you might have to proceed by elimination of variables. I did some of that last night, but may perhaps have done something wrong, as after only a few equations, a simple substitution of variables ran all night.
Sourabh Bajaj
el 7 de Jun. de 2011
Sourabh Bajaj
el 7 de Jun. de 2011
Respuestas (0)
Categorías
Más información sobre Equation Solving en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!