example1.m

来自「这个是支持向量聚类机用matlab编译的主程序和部分子程序」· M 代码 · 共 33 行

M
33
字号
% % Example1: % ---------% Shape: A Triangle % Dimension: 2% with outliersfunction [Samples, nof_samples, classification] = Example1()% The first sample is at  (0.1,0.05)Samples = [0.1; 0.05];% Add more(99) samples randomly choosen from the [0,1] intervalfor i = 1:99    x = rand(2,1);    % y must be larger then x to create the triangle    while x(2) > x(1)          x = rand(2,1);    end    Samples = [Samples x];end% Outliers:%add=[0.52 0.51 0.50 0.49 0.48 0.47 0.46 0.45 0.44 0.43 0.42 0.41 0.40 0.39 0.38; 0.48 0.49 0.50 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.60 0.62 0.63];add=[0.50 0.40 0.30 0.20 ; 0.50 0.60 0.70 0.80];Samples = [Samples, add];% Plotfigure;plot(Samples(1,:),Samples(2,:),'+');nof_samples = size(Samples,2);classification = zeros(nof_samples,1);

⌨️ 快捷键说明

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