% % 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; rand('seed',0); randn('seed',0); % the required data: % X1 = [ 0.1, -0.2; 0.2, 0.1; -0.15, 0.2; 1.1, 0.8; 1.2, 1.1 ]; X2 = [ 1.1, -0.1; 1.25, 0.15; 0.9, 0.1; 0.1, 1.2; 0.2, 0.9 ]; h1 = plot( X1(:,1), X1(:,2), '.b' ); hold on; h2 = plot( X2(:,1), X2(:,2), '.r' ); hold on; legend( [h1,h2], {'class 1', 'class 2'} ); axis( [-1,+2,-1,+2] ); % Lets draw some decision regions: % x1 = linspace( -1, +2, 50 ); x2 = -x1 + 1.65; % the top line g_1 plot( x1, x2, 'r-' ); text( 1.5, 0.2, 'g_1(x_1,x_2)=0' ); text( -.2, 1.95, '+' ); text( -.2, 1.75, '-' ); x2 = -x1 + .65; % the bottom line plot( x1, x2, 'r-' ); text( -.9, 1., 'g_2(x_1,x_2)=0' ); text( +1.4, -.65, '+' ); text( +1.4, -.85, '-' ); text( 0.5, 1.75, '(y_1,y_2)=(1,1)' ); text( 0.45, 0.55, '(y_1,y_2)=(0,1)' ); text( -0.75, -0.5, '(y_1,y_2)=(0,0)' ); xlabel('x_1'); ylabel('x_2'); fn = ['chap_4_prob_1_class_regions.eps']; saveas(gcf,['../../WriteUp/Graphics/Chapter4/',fn],'epsc');