Explicit root of symbolic equations
1 view (last 30 days)
Show older comments
I am trying to find the explicit roots of symbolic equations like the code bellow:
syms d1 d2 d3 d4 d5 d6 h11 h12 h13 h14 h21 h22 h23 h24 h41 h42 h45 h46 h51 h52 h55 h56 h61 h62 h65 h66
eq1 = h11*d1+h12*d2+h13*d3+h14*d4 == 0;
eq2 = h21*d1+h22*d2+h23*d3+h23*d4 == 0;
eq3 = d1+d2+d3+d4-d5-d6 == 0;
eq4 = h41*d1+h42*d2-h41*d3-h42*d4-h45*d5-h46*d6 == 0;
eq5 = h51*d1+h52*d2+h51*d3+h52*d4-h55*d5-h56*d6 == 0;
eq6 = h61*d1+h62*d2-h61*d3-h62*d4-h65*d5-h66*d6 == 0;
eq = [eq1,eq2,eq3,eq4,eq5,eq6];
var = [d1 d2 d3 d4 d5 d6];
S = solve(eq, var)
but the program return me the results like that
S =
struct with fields:
d1: [1×1 sym]
d2: [1×1 sym]
d3: [1×1 sym]
d4: [1×1 sym]
d5: [1×1 sym]
d6: [1×1 sym]
Can anybody please help me to find the explicit roots? Thanks you so much!
0 Comments
Accepted Answer
Stephan
on 22 Oct 2019
syms d1 d2 d3 d4 d5 d6 h11 h12 h13 h14 h21 h22 h23 h24 h41 h42...
h45 h46 h51 h52 h55 h56 h61 h62 h65 h66
eq1 = h11*d1+h12*d2+h13*d3+h14*d4 == 0;
eq2 = h21*d1+h22*d2+h23*d3+h23*d4 == 0;
eq3 = d1+d2+d3+d4-d5-d6 == 0;
eq4 = h41*d1+h42*d2-h41*d3-h42*d4-h45*d5-h46*d6 == 0;
eq5 = h51*d1+h52*d2+h51*d3+h52*d4-h55*d5-h56*d6 == 0;
eq6 = h61*d1+h62*d2-h61*d3-h62*d4-h65*d5-h66*d6 == 0;
% Solve for d1...d6
sol_d1 = isolate(eq1,d1)
sol_d2 = isolate(eq2,d2)
sol_d3 = isolate(eq3,d3)
sol_d4 = isolate(eq4,d4)
sol_d5 = isolate(eq5,d5)
sol_d6 = isolate(eq6,d6)
gives:
sol_d1 =
d1 == -(d2*h12 + d3*h13 + d4*h14)/h11
sol_d2 =
d2 == -(d1*h21 + d3*h23 + d4*h23)/h22
sol_d3 =
d3 == d5 - d2 - d4 - d1 + d6
sol_d4 =
d4 == -(d3*h41 - d2*h42 - d1*h41 + d5*h45 + d6*h46)/h42
sol_d5 =
d5 == (d1*h51 + d2*h52 + d3*h51 + d4*h52 - d6*h56)/h55
sol_d6 =
d6 == -(d3*h61 - d2*h62 - d1*h61 + d4*h62 + d5*h65)/h66
This is what you wanted to get?
More Answers (0)
See Also
Categories
Find more on Financial Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!