Your definition of a constant (or invariant) data with rand is problematic. If you increase the size of your data (n=1000, n=10000...), you can always increase the deviations (so what threshold for sigma ?). I think that with real data, this artifact isn't possible. No ?
Nice solution that looks pretty nifty but it actually produces an unsafe result, just like Matlab's own zscore. It passed on it's first run trough the test suite but fails on some number of repeats. I've now added a second pass with a know random seed.
Back to basics 18 - justification
Get the length of a given vector
Calculate Euler's phi function
Only once: cleaning up your columns
Six Steps to PCA - Step 2: Covariance
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office