zhenyupan 发表于 2012-3-21 14:21:38

matlab中定义有含未知数的矩阵的问题

我要定义一个含有未知数的矩阵,代码如下:
syms x1 x2 x3 x4 x5 x6
coefs (:, :, 1) = ;
coefs (:, :, 2) = ;
coefs (:, :, 2) = ;

为什么会出现下面的错误啊?
The following error occurred converting from sym to double:
Error using mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.


求高人指点,不胜感激!!!

liuyalong008 发表于 2012-3-21 16:15:56

syms x1 x2 x3 x4 x5 x6
a = ;
b = ;
c = ;
coefs (:, :, 2) = b
coefs (:, :, 1) = a
coefs (:, :, 3) = c>> coefs


coefs(:,:,1) =

[ 0, 0, 0, 1]
[ 1, 0, 0, 1]
[ 2, 0, 0, 1]
[ 3, 0, 0, 1]
[ 4, 0, 0, 1]
[ 5, 0, 0, 1]


coefs(:,:,2) =

[ 0, x1/2, 0, 1]
[ 1, x2/2, 0, 1]
[ 2, x3/2, 0, 1]
[ 3, x4/2, 0, 1]
[ 4, x5/2, 0, 1]
[ 5, x6/2, 0, 1]


coefs(:,:,3) =

[ 0, x1, 0, 1]
[ 1, x2, 0, 1]
[ 2, x3, 0, 1]
[ 3, x4, 0, 1]
[ 4, x5, 0, 1]
[ 5, x6, 0, 1]

zhenyupan 发表于 2012-3-21 17:59:11

本帖最后由 zhenyupan 于 2012-3-21 18:03 编辑

谢谢“liuyalong008 ”了,非常感谢

zhenyupan 发表于 2012-3-21 18:02:50

liuyalong008 发表于 2012-3-21 16:15 static/image/common/back.gif


非常感谢你,为什么要这样用才可以啊?
页: [1]
查看完整版本: matlab中定义有含未知数的矩阵的问题