根據 help linspace 來看:
LINSPACE Linearly spaced vector.
LINSPACE(X1, X2) generates a row vector of 100 linearly
equally spaced points between X1 and X2.
LINSPACE(X1, X2, N) generates N points between X1 and X2.
For N < 2, LINSPACE returns X2.
Class support for inputs X1,X2:
float: double, single
linsapce (1,100)的意思就是產生一個row 向量, 從1到100,共100個點,第三個參數是個數,不寫就是默認是100,
所以橫軸總長度是 100-1 =99, 個數是100個, 所以中間間隔是100-1 = 99,
長度/間隔 = 每個累增加的值
99/99 = 1
>> linspace(1,100)
ans =
Columns 1 through 19
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Columns 20 through 38
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Columns 39 through 57
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
Columns 58 through 76
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
Columns 77 through 95
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
Columns 96 through 100
96 97 98 99 100
linsapce (1,100,12) 就是11個, 每個間隔9
>> linspace(1,100,12)
ans =
1 10 19 28 37 46 55 64 73 82 91 100
x=[1;9;100] 也是同義的寫法, 中間9是間隔
>> x=[1:9:100]
x =
1 10 19 28 37 46 55 64 73 82 91 100
[晚上8:18
|
0
意見
]
0 意見
張貼留言