File Exchange

image thumbnail

Spectral Clustering

version (2.28 KB) by Elie
Assemble unknown data into cluster


Updated 12 May 2014

View Version History

View License

spcl(data, nbclusters, varargin) is a spectral clustering function to assemble random unknown data into clusters. after specifying the data and the number of clusters, next parameters can vary as wanted. This function will construct the fully connected similarity graph of the data. The first parameter of varargin is the name of the function to use, the second is the parameter to pass to the function.
Third parameter is the type of the Laplacian matrix:
'unormalized' - unnormalized laplacian matrix
'sym' - normalized symmetric laplacian matrix
'rw' - normalized asymmetric laplacian matrix
(if omitted the default will be 'unnormalized')
then the algorithm used for organizing eigenvectors:
'np' - generally used for 2 clusters, one eigenvector must be used, if will put positive values in class 1 and negative values in class 2
'kmean' - a k-mean algorithm will be used to cluster the given eigenvectors

finally an eigenvector choice can be added, it can be a vector [vmin vmax] or a matrix defining several intervals. if not found the default will be [2 2]

Cite As

Elie (2021). Spectral Clustering (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

muhammad ismat

How do I use normalized symmetric laplacian matrix as input

fisher muse

I failed using this function. Could you add an example to illustrate this function more detailed?

I use this function as"[ClusterOrders,Centroids,~]=spcl(Data,Num,'gaussfunc' 10,'sym','kmean');"
But matlab says:Undefined function 'gaussfunc' for input arguments of type 'double'.


Thank you Matt J, I added it to the Required Products

Matt J

You might want to add to the submission page information that it requires the Statistics Toolbox (to support kmeans).


Hey wang, sorry for the late response but I was traveling and very busy this month, you still need some help ?


I need some help about the image segmentation basee on the spectral clustering.wa wa wa,give me a hand,thanks very much!


thanks very much!

MATLAB Release Compatibility
Created with R2012b
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!