% % Written by: % -- % John L. Weatherwax 2005-08-04 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % % Epage 169 % %----- close all; clc; clear; % Lets plot the data: % XB = [ -1.75, +1.5; -1.65, +1.; -1.5, -0.75; -0.5, 0.25; 0.7, -0.9; 1.2, -1.1]; % class B XA = [ -0.5, +0.8; 0, 0.3; 0.5, 0.75; 0.9, -1.3 ]; hA = plot( XA(:,1), XA(:,2), 'or' ); hold on; hB = plot( XB(:,1), XB(:,2), '.b' ); hold on; legend( [hA,hB], {'class +1 (A)', 'class -1 (B)'}, 'location', 'north' ); axis( [-3,+3,-3,+3] ); % Lets draw some decision regions: % x1 = linspace( -3, +3, 50 ); % the line #1: x2 = -x1; plot( x1, x2, 'k-' ); hold on; text( -2.7, 2.85, '1' ); text( -2.5, 2.4, '-' ); text( -2.5, 2.6, '+' ); % the line #2 x2 = x1; plot( x1, x2, 'k-' ); text( 2.5, 2.75, '2' ); text( 2.1, 2.3, '+' ); text( 2.1, 2.1, '-' ); % the line #3 addpath('~/Matlab'); hline( -1, 'k-' ); text( -2.75, -0.9, '3' ); text( -2.6, -0.9, '+' ); text( -2.6, -1.1, '-' ); text( 0.9, -1.6, 'A_1' ); text( 1.35, -1.25, 'B_1' ); xlabel('x_1'); ylabel('x_2'); %grid on; fn = ['chap_4_tiling_example.eps']; saveas(gcf,['../../WriteUp/Graphics/Chapter4/',fn],'epsc');