📄 graphxy.m
字号:
function graphxy (X,Y,caption,xaxis,yaxis,pts)
%----------------------------------------------------------------
% Usage: graphxy (X,Y,caption,xaxis,yaxis,pts)
%
% Description: Graph the columns of Y vs. the columns of X
%
% Inputs: X = m by p matrix containing independent
% variables (p = 1 or p = n)
% Y = m by n matrix containing dependent
% variables
% caption = string containing graph title
% xaxis = string containing x-axis label
% yaxis = string containing y-axis label
% pts = optional display mode. If pts is
% present, then the last column of Y is
% plotted using isolated plot symbols
% specified by the one-character string
% pts. Examples include 's' for square,
% 'd' for diamond and 'o' for circle.
% See help plot for more examples.
%----------------------------------------------------------------
colors = 'bgrcmy';
[m,n] = size(Y);
p = size (X,2);
% plotedit on
figure
zoom on
box on
points = nargin > 5;
if ~points
plot (real(X),real(Y))
else
hold on
for j = 1 : n-1
k = 1 + rem(j-1,7);
q = min (j,p);
plot (real(X(:,q)),real(Y(:,j)),colors(k));
end
k = 1 + rem(n-1,7);
q = min (n,p);
plot (real(X(:,q)),real(Y(:,n)),[colors(k) pts(1)]);
hold off
end
title (caption)
xlabel (xaxis)
ylabel (yaxis)
wait
%----------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -