matlab怎么写[1 -1 1 -1 .]向量
来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/10/06 23:44:44
matlab怎么写[1 -1 1 -1 .]向量
在做这道题:
Make the vector lin =[1 2 ⋯ 20] (the integers from 1 to 20),and then make
every other value in it negative to get lin =[1 −2 3 −4 ⋯ −20]
在做这道题:
Make the vector lin =[1 2 ⋯ 20] (the integers from 1 to 20),and then make
every other value in it negative to get lin =[1 −2 3 −4 ⋯ −20]
lin=1:20;
for n=1:length(lin)
lin(n)=lin(n)*(-1).^(n+1)
end
lin
结果为:
Columns 1 through 17
1 -2 3 -4 5 -6 7 -8 9 -10 11 -12 13 -14 15 -16 17
Columns 18 through 20
-18 19 -20
for n=1:length(lin)
lin(n)=lin(n)*(-1).^(n+1)
end
lin
结果为:
Columns 1 through 17
1 -2 3 -4 5 -6 7 -8 9 -10 11 -12 13 -14 15 -16 17
Columns 18 through 20
-18 19 -20
matlab怎么写[1 -1 1 -1 .]向量
用MATLAB算向量如何用MATLAB计算空间向量的数量积、向量积、夹角和模若向量A=(1,2,3)怎么告诉MATLAB
matlab中 怎么将向量特定的数变为1
用matlab语言怎么将一个秩为1的矩阵分解成列向量和行向量相乘形式
matlab中一维单位向量怎么表示比如(1 0 0 0 0 0)
matlab怎么随机产生一个只有0和1的行向量
求教matlab中怎么把一个数转化成0-1表示的向量?
matlab中怎么定义元素相同的向量.比如1*27个1 A=ones[(1:1:27)] 怎么定义1行27列的2向量
怎么用matlab做一个n维以0或1为元素的索引向量L
matlab中怎么将从m*n的数据依次定义为1*n的行向量
matlab程序怎么使向量的每一个元素都加上0到1之间的一个数的倍数,
怎么让一个m*n的矩阵的每行与一个1*n的向量做点乘啊?matlab语言.谢谢啊