在Matlab中求解非线性方程组

时间:2017-07-21 09:43:32

标签: matlab

考虑以下等式:

eqn1 =


    sin(t6)*(cos(t4)*sin(t1) + sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))) + cos(t6)*(cos(t5)*(sin(t1)*sin(t4) - cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))) - sin(t5)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))) == 1


eqn2 =


    cos(t6)*(cos(t4)*sin(t1) + sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))) - sin(t6)*(cos(t5)*(sin(t1)*sin(t4) - cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))) - sin(t5)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))) == 0


eqn3 =


    - sin(t5)*(sin(t1)*sin(t4) - cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))) - cos(t5)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) == 0


eqn4 =


    cos(t1)/100 + (19*cos(t1)*cos(t2))/100 - (21*cos(t1)*sin(t2)*sin(t3))/1000 + (21*cos(t1)*cos(t2)*cos(t3))/1000 - (219*cos(t1)*cos(t2)*sin(t3))/1000 - (219*cos(t1)*cos(t3)*sin(t2))/1000 == 619/1000


eqn5 =


    - sin(t6)*(cos(t1)*cos(t4) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))) - cos(t6)*(cos(t5)*(cos(t1)*sin(t4) + cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))) + sin(t5)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))) == 0


eqn6 =


    sin(t6)*(cos(t5)*(cos(t1)*sin(t4) + cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))) + sin(t5)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))) - cos(t6)*(cos(t1)*cos(t4) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))) == 1


eqn7 =


    sin(t5)*(cos(t1)*sin(t4) + cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))) - cos(t5)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) == 0


eqn8 =


    sin(t1)/100 + (19*cos(t2)*sin(t1))/100 - (219*cos(t2)*sin(t1)*sin(t3))/1000 - (219*cos(t3)*sin(t1)*sin(t2))/1000 - (21*sin(t1)*sin(t2)*sin(t3))/1000 + (21*cos(t2)*cos(t3)*sin(t1))/1000 == 0


eqn9 =


    sin(t4)*sin(t6)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) - cos(t6)*(sin(t5)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) + cos(t4)*cos(t5)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))) == 0


eqn10 =


    sin(t6)*(sin(t5)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) + cos(t4)*cos(t5)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))) + cos(t6)*sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) == 0


eqn11 =


    cos(t4)*sin(t5)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) - cos(t5)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) == 1


eqn12 =


    (219*sin(t2)*sin(t3))/1000 - (219*cos(t2)*cos(t3))/1000 - (21*cos(t2)*sin(t3))/1000 - (21*cos(t3)*sin(t2))/1000 - (19*sin(t2))/100 == 261/1000

是否有可以解决这些方程的函数?

1 个答案:

答案 0 :(得分:2)

fminsearch应该做到这一点。

https://de.mathworks.com/help/matlab/ref/fminsearch.html

请注意,如果问题不凸,求解非线性方程可能会导致局部最优而不是全局最优。在许多实际情况中,你无法确保全局最优。

你需要重新制定这个以使其成为最小化问题。

例如,

f(x)= 1可写为最小值abs(f(x)-1)