?? example43_figure_a.m
字號(hào):
%svm3_figure_a:to look the figure of input data
%==============
%==============
function figure_a()
X = [2 7; 3 6; 2 2; 8 1; 6 4; 4 8; 9 5; 9 9; 9 4; 6 9; 7 4];
Y = [ +1; +1; +1; +1; +1; -1; -1; -1; -1; -1; -1];
% define a simple artificial data set
x1ran = [0 10];
x2ran = [0 10];
% range for plotting the data set and the decision boundary
% disp(' ');
% disp('This demonstration illustrates the use of a Support Vector Machine');
% disp('(SVM) for classification. The data is a set of 2D points, together');
% disp('with target values (class labels) +1 or -1.');
% disp(' ');
% disp('The data set consists of the points');
ind = [1:length(Y)]';
% fprintf('X%2i = (%2i, %2i) with label Y%2i = %2i\n', [ind, X, ind, Y]');
% disp(' ')
% disp('Press any key to plot the data set');
%
% pause
f1 = figure;
plotdata(X, Y, x1ran, x2ran);
title('Figure a: Data from class +1 (squares) and class -1 (crosses)');
function plotdata(X, Y, x1ran, x2ran)
% PLOTDATA - Plot 2D data set
%
hold on;
ind = find(Y>0);
plot(X(ind,1), X(ind,2), 'ks');
ind = find(Y<0);
plot(X(ind,1), X(ind,2), 'kx');
text(X(:,1)+.2,X(:,2), int2str([1:length(Y)]'));
axis([x1ran x2ran]);
axis xy;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -