corrplot.m

来自「人工神经网络:MATLAB源程序用于训练测试」· M 代码 · 共 37 行

M
37
字号
%# function r = corrplot(y,yhat,plotindex)						
%#											
%# AIM:		Calculates linear correlation coefficient between two vectors and	
%#		displays correlation plot.						
%# 											
%# INPUT:	y : first n-element vector (e.g. vector of experimental responses)	
%#		yhat : second n-element vector (e.g. vector of predicted responses)	
%#		       the vector must have the same dimentions as y.			
%#		plotindex (optional) : any input causes the correlation plot to be 	
%#				       displayed					
%#											
%# OUTPUT:	r : linear correlation coefficient between the two vectors		
%#											
%# AUTHOR:	Frederic Despagne							
%#		Copyright(c) 1997 for ChemoAC						
%#		Dienst FABI, Vrije Universiteit Brussel					
%#		Laarbeeklaan 103, 1090 Jette						
%#											
%# VERSION: 1.1 (28/02/1998)								
%#											
%# TEST: 	Roy De Maesschalck							

function r = corrplot(y,yhat,plotindex);

coeff = corrcoef(y,yhat);		% Calculate correlation matrix
r = coeff(1,2);				% Correlation coefficient between the two vectors

if nargin == 3				
	clf
	plot(y,yhat,'*b',y,y)		% Display correlation plot (optional)
	rens=sprintf('r=%10.5f',r);
	title(rens); xlabel('Observed values'); ylabel('Estimated values')
end



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?