residuals = pcares(X, NumComponents)
[residuals, reconstructed] = pcares(X, NumComponents)
pcares returns residuals obtained by retaining the requested number of principal components of the data matrix X.
The reconstructed output is the low-dimensional approximation of X, and residuals is equal to X minus reconstructed.
X = [1 2; 3 4; 5 8; 7 11];
[residuals, reconstructed] = pcares(X, 1)
| Version | Description |
|---|---|
| 2.0.0 | initial version |