首页 > 代码库 > MATLAB画图,隐藏部分legends和使用带latex公式的标签例子

MATLAB画图,隐藏部分legends和使用带latex公式的标签例子

技术分享

%clear
% http://www.peteryu.ca/tutorials/matlab/visualize_decision_boundaries

% load RankData
% NumTrain =200;

%load RankData2
%(11,10), [15,15];[20,15];
%[5,0,0,5],[2,0;0,5];[5,0;0,2];

mu = [13,8.5];
sigma = [0.4,-0.2;-0.2,0.4];
 rng default  % For reproducibility
r1 = mvnrnd(mu,sigma,60);
mu = [13,7.5];
sigma = [1,-0.2;-0.2,1];
r11 = mvnrnd(mu,sigma,10);
mu = [15,10];
sigma = [0.4,0;0,0.4];
r2 = mvnrnd(mu,sigma,60);
r22 = mvnrnd(mu,sigma,10);
mu = [16.5,8.5];
sigma =  [0.5,0.2;0.2,0.4];
r3 = mvnrnd(mu,sigma,60);
mu = [16.5,7.5];
sigma =  [1,0.2;0.2,1];
r33 = mvnrnd(mu,sigma,10);
X=[r1;r2;r3]; 
y=[ones(size(r1,1),1);2*ones(size(r2,1),1);3*ones(size(r3,1),1)];
xrange = [min(X(:,1))-1 max(X(:,1))+1];
yrange = [min(X(:,2))-1.1 max(X(:,2))+1];


% mu = [-3.5,-3.5];
% sigma =  [1,-0.5;-0.5,2];
% rng default  % For reproducibility
% r1 = mvnrnd(mu,sigma,50);
% mu = [0,0];
% sigma = [2,-0.4;-0.4,1];
% r2 = mvnrnd(mu,sigma,50);
% mu = [3.5,3.5];
% sigma =  [1,-0.5;-0.5,2];
% r3 = mvnrnd(mu,sigma,50);
% X=[r1;r2;r3]; 
% y=[ones(size(r1,1),1);2*ones(size(r2,1),1);3*ones(size(r3,1),1)];
% xrange = [-8 8];
% yrange = [-8 8];


% Traindata=http://www.mamicode.com/X; Targets=y;>

  

MATLAB画图,隐藏部分legends和使用带latex公式的标签例子