matlab小白又来提问了 今天是有关于SOLVE函数的
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/23 22:41:56
matlab小白又来提问了 今天是有关于SOLVE函数的
syms x1 x2 x3 x4
[x1.x2.x3.x4]=solve('x1+x2+x3+x4=1','39.8667*x1+ 50.7441*x2+29.3857*x3+ 29.0516*x4=39.82','44.0964*x1+60.4699*x2+30.7047*x3+29.2015*x4=44.72','48.0599*x1+69.2528*x2+32.0626*x3+29.1076*x4=49.10','x1','x2','x3','x4')
>> x1=eval(x1)
x1 =
x1
想解出 X1 X2 X3 X4 但是怎么都解不出来 正确的应该怎么写啊
syms x1 x2 x3 x4
[x1.x2.x3.x4]=solve('x1+x2+x3+x4=1','39.8667*x1+ 50.7441*x2+29.3857*x3+ 29.0516*x4=39.82','44.0964*x1+60.4699*x2+30.7047*x3+29.2015*x4=44.72','48.0599*x1+69.2528*x2+32.0626*x3+29.1076*x4=49.10','x1','x2','x3','x4')
>> x1=eval(x1)
x1 =
x1
想解出 X1 X2 X3 X4 但是怎么都解不出来 正确的应该怎么写啊
简单.这么写.
y=solve('x1+x2+x3+x4=1','39.8667*x1+ 50.7441*x2+29.3857*x3+ 29.0516*x4=39.82','44.0964*x1+60.4699*x2+30.7047*x3+29.2015*x4=44.72','48.0599*x1+69.2528*x2+32.0626*x3+29.1076*x4=49.10')
得结果
y =
x1: [1x1 sym]
x2: [1x1 sym]
x3: [1x1 sym]
x4: [1x1 sym]
然后分别执行y.x1,y.x2,y.x3,y.x4
得结果
x1 .13668082854303990850311923939831
x2 .42688872616706644220551540549839
x3 .89492603547082574093900569318886e-1
x4 .34693784174281107519746478578441
取自己喜欢的位就可以了
y=solve('x1+x2+x3+x4=1','39.8667*x1+ 50.7441*x2+29.3857*x3+ 29.0516*x4=39.82','44.0964*x1+60.4699*x2+30.7047*x3+29.2015*x4=44.72','48.0599*x1+69.2528*x2+32.0626*x3+29.1076*x4=49.10')
得结果
y =
x1: [1x1 sym]
x2: [1x1 sym]
x3: [1x1 sym]
x4: [1x1 sym]
然后分别执行y.x1,y.x2,y.x3,y.x4
得结果
x1 .13668082854303990850311923939831
x2 .42688872616706644220551540549839
x3 .89492603547082574093900569318886e-1
x4 .34693784174281107519746478578441
取自己喜欢的位就可以了