NCL Home > Documentation > Functions > Array creators

fspan

Creates an array of evenly-spaced floating point numbers.

Prototype

	function fspan (
		start  [1] : numeric,  
		finish [1] : numeric,  
		num    [1] : integer   
	)

	return_val [num] :  float

Arguments

start

Value at which to start.

finish

Value at which to end.

num

Number of equally-spaced points desired between start and finish.

Description

fspan returns a 1D array with num equally-spaced points from start to finish, inclusive.

If start or finish are of type double, both start and finish are promoted to type double. If start or finish are of any other numeric type, both start and finish are promoted to type float.

See Also

ispan, random_uniform

Examples

In the example below, note that the integers 0 and 100 will be coerced to the type float, as required by the fspan function.

   x = fspan(0, 100, 11)   ; x = (/0., 10., ... , 90., 100./) (11 values)

   mlon = 128
   dlon = 360. / mlon
   lon  = fspan (0, (mlon - 1) * dlon, mlon)    ; lon = (/0, 2.8125, ... , 357.1875/)