本帖最后由 ranzuo 于 2019-3-14 14:15 编辑
我想用matlab的solve函数解一个五元二次方程,代码如下:
syms x y z h d
[x,y,z,d,h]=solve('x/1.61272+y/1.62536+z/1.61272=0','123.454321*x/58.63+h^2*y/35.56+d^2*z/58.63=0','11.111*x/58.63-d*z/58.63=0','11.111*x+h*y+d*z=0.11111','(11.111-h)/(11.111*x)=(h-d)/(11.111*x+h*y)')
但是我运行得到的完整结果是:
警告: Support of strings that are not valid variable names or define a number will be removed in a future release. To create symbolic expressions, first
create symbolic variables and then use operations on them.
> In sym>convertExpression (line 1536)
In sym>convertChar (line 1441)
In sym>tomupad (line 1198)
In sym (line 177)
In solve>getEqns (line 405)
In solve (line 225)
In wuyuan3cifangcheng (line 2)
x =
9.8051708423532859010205751546499
-11.111
- 4.2939688552237898923971319476258 - 3.8334451684331884445774818512047i
- 4.2939688552237898923971319476258 + 3.8334451684331884445774818512047i
y =
8.0971053068102517128005979785684
0.000000000000000000000000000000011526917256959529113260704336315
2.2110088166176587241044445353733 - 5.7965981734428257281857401510778i
2.2110088166176587241044445353733 + 5.7965981734428257281857401510778i
z =
0.02308031395639232033744787680965
0.005
0.006322211836319206204936374536974 + 0.0021895616689443335111497075166201i
0.006322211836319206204936374536974 - 0.0021895616689443335111497075166201i
d =
-0.049620292871950604127366086465117
1.0556554855194325856399242614967e-35
0.0056399730054333487179179055622729 - 0.0072201350196966408188249354161664i
0.0056399730054333487179179055622729 + 0.0072201350196966408188249354161664i
h =
0.026154094864085714244605228326457
-0.005
- 0.011918324245460854913136751474015 + 0.0049744242473850744854389558221847i
- 0.011918324245460854913136751474015 - 0.0049744242473850744854389558221847i,
这里我有两个疑问:1、应该每个未知数最多两个解包括虚数解,而上面有四个,这是为什么
2、即使这么多实数解,也与书本给出的实数解不一样,(书中给出实数解答案是x=0.0230803,y=-0.0496203,z=0.0261541,h=8.097,d=9.805),我只需要实数解。
请各位坛友帮忙出出招,该方程组如何求解,谢谢!运行程序见附件