plotlines.m

来自「线性M3网络及其示意图」· M 代码 · 共 62 行

M
62
字号
% plotlines sub
clc
clear all
global C1 C2
C1=[0.4 0.5
    %0.5 0.40
    %0.5 0.75
    %0.65 0.15
    ];  % positive class

C2=[0.1  0.6
    0.15  0.41
    0.25  0.8
    0.30  0.6
    %0.8  0.76
    %0.9  0.4
    ];%negative class


[X,Y] = meshgrid(0:0.01:1);



NC1=size(C1,1);
NC2=size(C2,1);

figure(NC1+NC2);

[X,Y] = meshgrid(0:0.005:1.0);
Z=G(X,Y);
contourf(X,Y,Z)



hold on
plot(C1(:,1),C1(:,2),'gs','MarkerFaceColor',[0 1 0]);
plot(C2(:,1),C2(:,2),'w*');




C1=C1;
C2=C2;

X=0:1:100;

C=[ 'c', 'm', 'y', 'r', 'g', 'b', 'w', 'k']

for i=1:NC1
         %c=C(i);
       for j=1:NC2
           Y=((C1(i,1)-C2(j,1))*X+0.5*(norm(C2(j,:))^2-norm(C1(i,:))^2))/(-(C1(i,2)-C2(j,2)));
           c=C(j);
           plot(X,Y,'linewidth',2,'color',c);
       end

end



axis square
colormap hot

⌨️ 快捷键说明

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