1、向量与数的加法
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> a+100
ans =
101 112 123 134 145 156 167 178 189 200
2、向量与数的减法
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> a-10
ans =
-9 2 13 24 35 46 57 68 79 90
3、向量与数的乘法
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> a*10
ans =
Columns 1 through 8
10 120 230 340 450 560 670 780
Columns 9 through 10
890 1000
4、向量与数的除法
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> a/10
ans =
0.1000 1.2000 2.3000 3.4000 4.5000 5.6000 6.7000 7.8000 8.9000 10.0000
5、向量与向量的加法
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> b = linspace(1,50,10)
b =
1.0000 6.4444 11.8889 17.3333 22.7778 28.2222 33.6667 39.1111 44.5556 50.0000
>> a+b
ans =
2.0000 18.4444 34.8889 51.3333 67.7778 84.2222 100.6667 117.1111 133.5556 150.0000
6、向量与向量的减法
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> b = linspace(1,50,10)
b =
1.0000 6.4444 11.8889 17.3333 22.7778 28.2222 33.6667 39.1111 44.5556 50.0000
>> a-b
ans =
0 5.5556 11.1111 16.6667 22.2222 27.7778 33.3333 38.8889 44.4444 50.0000
7、向量与向量的点积
>> a = linspace(1,100,10)
a =
1 12 23 34 45 56 67 78 89 100
>> b = linspace(1,50,10)
b =
1.0000 6.4444 11.8889 17.3333 22.7778 28.2222 33.6667 39.1111 44.5556 50.0000
>> dot(a,b)
ans =
1.7818e+04
8、向量与向量的叉积
>> a=[2,4,6]
a =
2 4 6
>> b=[1,3,5]
b =
1 3 5
>> cross(a,b)
ans =
2 -4 2
9、向量与向量的混合积
>> a=[2,4,6]
a =
2 4 6
>> b=[1,3,5]
b =
1 3 5
>> c=[4,8,12]
c =
4 8 12
>> dot(a,cross(b,c))
ans =
0