你需要的是 CORRCOEF 函数: R = corrcoef(vector1(:),vector2(:)); %# Returns a 2-by-2 matrix of %# correlation coefficients 如果您拥有统计工具箱,您可能还想查看函数CORR: RHO = corr(vector1(:),vector2(:)); %# Returns the linear correlation coefficient %# (default is a Pearson correlation)