📄 stat_plo.m
字号:
function stat_plo(x,a,b)
% STAT_PLOT ... Scatter diagram plotting function.
%
% STAT_PLOT(X,A,B) operates on the input data array X which must
% have been generated by the MATLAB function PERSON_DATA.
% The flags A and B specify which characteristics will
% be extracted from the array X. Allowable choices for
% A and B are:
%
% 'age' 'height' 'weight'
%
% The corresponding scatter diagram will be then displayed.
%
% AUTHORS : M. Zeytinoglu & N. W. Ma
% Department of Electrical & Computer Engineering
% Ryerson Polytechnic University
% Toronto, Ontario, CANADA
%
% DATE : August 1991.
% VERSION : 1.0
%===========================================================================
% Modifications history:
% ----------------------
% o Tested (and modified) under MATLAB 4.0/4.1 08.16.1993 MZ
%===========================================================================
if strcmp(a,'age')
yx = x(:,1);
elseif strcmp(a,'height')
yx = x(:,2);
elseif strcmp(a,'weight')
yx = x(:,3);
else
error('Invalid option');
end
if strcmp(b,'age')
yy = x(:,1);
elseif strcmp(b,'height')
yy = x(:,2);
elseif strcmp(b,'weight')
yy = x(:,3);
else
error('Invalid option');
end
plot(yx,yy,'*'), grid on
if strcmp(a,'age')
xlabel('age');
elseif strcmp(a,'height')
xlabel('height [cm]');
else
xlabel('weight [kg]');
end
if strcmp(b,'age')
ylabel('age');
elseif strcmp(b,'height')
ylabel('height [cm]');
else
ylabel('weight [kg]');
end
hold off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -