This function is just a nice wrapper for Matlab's built-in SVD function, which
only operates in 2D data sets. The wrapper just reshapes the matrices
before and after applying SVD such that the input series X can be
n-dimensional and ensures the output modes U are also n-dimensional.
%POD has several names (POD, SVD, PCA, ...) and is a mathematical tool that
%highlights the principal modes of a random series of variables (i.e.,
%financial measurements, fluid flow fields, structural vibrations, neuron
%firing patterns, video frames, and basically anything imaginable!)
%The POD tool is extremely useful in data analysis to identify the most
%energetic modes of a complex system by simply performing measurements when
%its operating. (But if you're already here you already know all of this.)
%X - Time series or snapshots to be analyzed. Can be a n-dimensional matrix
%(n>=2). First dimension is time/snapshot, and all other dimensions are
%conserved for output.
%U - Mode matrix, has the same size of X. First dimension of X was
%"time/snapshot", therefore first dimension of U will be "mode". Modes are
%automatically organized from most energetic U(1,:,:...) to least
%S - Mode eigenvalues. S.^2 gives the mode energies. S is a diagonal
%matrix, so returns just the vector S to save one line of post-processing.
%V - Mode time-series or snapshot coefficients - V contains the
%contribution of each mode to a specific snapshot of X. U*S*V gives back X
%(given U and X are reshaped into 2D matrices again).
Fernando Zigunov (2019). POD - Proper Orthogonal Decomposition (Wrapper) (https://www.mathworks.com/matlabcentral/fileexchange/72022-pod-proper-orthogonal-decomposition-wrapper), MATLAB Central File Exchange. Retrieved .