Explicit root of symbolic equations

3 次查看(过去 30 天)
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!

采纳的回答

Stephan
Stephan 2019-10-22
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?
  1 个评论
Ductho Le
Ductho Le 2019-10-22
actually I want more detail but thanks you i have found solution based on your help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Financial Toolbox 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by