www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CorrelationCoefficientsAndPValuesOfMatrixExample.m

    %% P-Values of Matrix
% Compute the correlation coefficients and p-values of a normally
% distributed, random matrix, with an added fourth column equal to the sum
% of the other three columns. Since the last column of |A| is a linear combination of the others, a
% correlation is introduced between the fourth variable and each of the other
% three variables.  Therefore, the fourth row and fourth column of |P| contain very small
% p-values, identifying them as significant correlations.

% Copyright 2015 The MathWorks, Inc.

A = randn(50,3);       
A(:,4) = sum(A,2); 
[R,P] = corrcoef(A)