linspace 函數 是創建等差數列的函數, 最好是在 Matlab 語言中見到這個函數的,近期在學習Python 中的 Numpy, 發現也有這個函數,以下給出自己在學習過程中的一些總結。
(1)指定起始點 和 結束點。
默認 等差數列個數為 50。
(2)指定等差數列個數
(3)如果數列的元素個數指定, 可以設置 結束點 狀態。
endpoint : bool, optional
If True, stop is the last sample. Otherwise, it is not included. Default is True.
(4)如果數列的元素個數指定, 可以設置 間隔屬性 狀態。
retstep : bool, optional
If True, return (samples, step), where step is the spacing between samples.
從上面的結果中可以看到,設置了步進差值返回的x,輸出成了元組,而元組的第二個元素為步進差值1.0。