matlab 带参数的矩阵赋值
已知A是一个6*12的矩阵,里面每一项都是以x为变量的式子;要得到一个6*6的矩阵B,B中每一列依次为A中的第4列至第9列。我原来是用B(1,1)=A(1,4);这样的方...
已知A是一个6*12的矩阵,里面每一项都是以x为变量的式子;
要得到一个6*6的矩阵B,B中每一列依次为A中的第4列至第9列。
我原来是用B(1,1)=A(1,4);这样的方法,但报错,好像是因为A(1,4)是带变量式子而不是数值出的错。
请问该怎么解决。 展开
要得到一个6*6的矩阵B,B中每一列依次为A中的第4列至第9列。
我原来是用B(1,1)=A(1,4);这样的方法,但报错,好像是因为A(1,4)是带变量式子而不是数值出的错。
请问该怎么解决。 展开
展开全部
从某一个矩阵中挖取4列到9列是这样的,按你的说法举例:
>> syms x
>> a = randi( 10, 6, 12 ) * x
a =
[ 9*x, 5*x, x, 9*x, 10*x, x, x, 3*x, 4*x, x, 5*x, 7*x]
[ 6*x, 2*x, 7*x, 9*x, 7*x, 2*x, 4*x, 5*x, 2*x, 8*x, 10*x, 7*x]
[ 2*x, 10*x, x, 8*x, 9*x, 2*x, 6*x, x, 5*x, 3*x, 4*x, 2*x]
[ 3*x, 8*x, x, 2*x, 5*x, 4*x, 5*x, 10*x, 4*x, 5*x, 8*x, 2*x]
[ 9*x, 6*x, 6*x, 7*x, 5*x, 9*x, 7*x, 2*x, 10*x, 6*x, 7*x, 10*x]
[ x, 5*x, x, 6*x, 9*x, 9*x, 7*x, 2*x, 10*x, 10*x, 6*x, 2*x]
>> b = a( :, 4 : 9 )
b =
[ 9*x, 10*x, x, x, 3*x, 4*x]
[ 9*x, 7*x, 2*x, 4*x, 5*x, 2*x]
[ 8*x, 9*x, 2*x, 6*x, x, 5*x]
[ 2*x, 5*x, 4*x, 5*x, 10*x, 4*x]
[ 7*x, 5*x, 9*x, 7*x, 2*x, 10*x]
[ 6*x, 9*x, 9*x, 7*x, 2*x, 10*x]
>> syms x
>> a = randi( 10, 6, 12 ) * x
a =
[ 9*x, 5*x, x, 9*x, 10*x, x, x, 3*x, 4*x, x, 5*x, 7*x]
[ 6*x, 2*x, 7*x, 9*x, 7*x, 2*x, 4*x, 5*x, 2*x, 8*x, 10*x, 7*x]
[ 2*x, 10*x, x, 8*x, 9*x, 2*x, 6*x, x, 5*x, 3*x, 4*x, 2*x]
[ 3*x, 8*x, x, 2*x, 5*x, 4*x, 5*x, 10*x, 4*x, 5*x, 8*x, 2*x]
[ 9*x, 6*x, 6*x, 7*x, 5*x, 9*x, 7*x, 2*x, 10*x, 6*x, 7*x, 10*x]
[ x, 5*x, x, 6*x, 9*x, 9*x, 7*x, 2*x, 10*x, 10*x, 6*x, 2*x]
>> b = a( :, 4 : 9 )
b =
[ 9*x, 10*x, x, x, 3*x, 4*x]
[ 9*x, 7*x, 2*x, 4*x, 5*x, 2*x]
[ 8*x, 9*x, 2*x, 6*x, x, 5*x]
[ 2*x, 5*x, 4*x, 5*x, 10*x, 4*x]
[ 7*x, 5*x, 9*x, 7*x, 2*x, 10*x]
[ 6*x, 9*x, 9*x, 7*x, 2*x, 10*x]
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询