image thumbnail


version (1.5 KB) by Sky Sartorius
Generates cosine- or acos-spaced vector with elements clustered or sparse at the endpoints


Updated 12 Oct 2010

View License

Utility function operates with no loops, so is of comparable speed to LINSPACE.

Using the same syntax as LINSPACE, COSSPACE makes a cosine spaced vector, clustering the elements toward the endpoints with greater spacing in the middle:

Given negative vector length, COSSPACE returns an inverse cosine spaced vector with elements sparse toward the endpoints:

An optional input in addition to the endpoints and the number of elements lets you choose the intensity of the clustering.

Cite As

Sky Sartorius (2021). cosspace (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!