sat函数用MATLAB如何写
1、function [coeff, score, latent, tsquare] = princomp(x,econFlag)
%PRINCOMP Principal Components Analysis (PCA) from raw data.
% COEFF = PRINCOMP(X) performs principal components analysis on the N-by-P
% data matrix X, and returns the principal component coefficients, also

2、 PRINCOMP centers X by subtracting off column means, but does not
rescale the columns of X. To perform PCA with standardized variables,
i.e., based on correlations, use PRINCOMP(ZSCORE(X)). To perform PCA directly on a covariance or correlation matrix, use PCACOV.

3、[COEFF, SCORE] = PRINCOMP(X) returns the principal component scores,
i.e., the representation of X in the principal component space. Rows
of SCORE correspond to observations, columns to components.

4、对于这个饱和函数。 delta=20; kk=1/delta; if abs(s)>delta; sat=sign(s); else sat=kk*s;这个是我在M文件S函数中的表达。

5、real_T kk,delta;real_T sat(real_T x){ if (fabs(x)>delta) return (sign(x)); else return (kk*x); };

6、end
end
Enforce a sign convention on the coefficients -- the largest element in each
column will have a positive sign.

7、[~,maxind] = max(abs(coeff),[],1);
d = size(coeff,2);
colsign = sign(coeff(maxind + (0:p:(d-1)*p)));
coeff = bsxfun(@times,coeff,colsign);
if nargout > 1
score = bsxfun(@times,score,colsign);
end
