linspace
Vector of equally spaced points between two endpoints.
Syntax
Section titled “Syntax”y = linspace(a, b)y = linspace(a, b, n)Description
Section titled “Description”Returns a row vector of n equally spaced values starting at a and ending at b (both inclusive). Default n is 100 (note: differs from MATLAB’s default of 100 — same here, but check before porting).
The spacing is (b - a) / (n - 1). Useful for generating x-axis grids for plotting and integration.
Examples
Section titled “Examples”linspace(0, 1, 5) % [0 0.25 0.5 0.75 1]linspace(-pi, pi, 100) % grid for plotting triglinspace(0, 10) % 100 points between 0 and 10See also
Section titled “See also”logspace— Vector of logarithmically (base-10) spaced points.