HW5_Code - a_final=FISSP(AugD figure;plot(D1,1,D1,2.b hold on;plot(D2,1,D2,2*r;hold on line =(x,y(a_final(1*x a_final(2*y a_final(3 ezplot(line-3,3

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
clear all;close all;clc; SIGMA = 0.2*eye(2); MU1 = [1;1]; MU2 = [0;0]; % samples from the given pdfs data1 = mvnrnd(MU1,SIGMA,50); data2 = mvnrnd(MU2,SIGMA,50); % remove samples to ensure linear separability D1 = data1((data1(:,1)+data1(:,2))>=1,:); D2 = data2((data2(:,1)+data2(:,2))<=1,:); % augmented weight vectors AugD1=[D1 ones(size(D1,1),1)]; AugD2=-[D2 ones(size(D2,1),1)]; % reflect about all the axes after augmenting AugD=[AugD1;AugD2]; AugD=AugD(randperm(size(AugD,1)),:); % scramble the data points from different classes
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a_final=FISSP(AugD) figure;plot(D1(:,1),D1(:,2),'.b'); hold on;plot(D2(:,1),D2(:,2),'*r');hold on; line = @(x,y) (a_final(1)*x + a_final(2)*y + a_final(3)); ezplot(line,[-3,3]) %%%%%%%%%%%%%%%%%%% FISSP %%%%%%%%%%%%%%%% function [a_final]=FISSP(AugD); a_init=[0;0;0]; N=size(AugD,1); i=0; a=a_init; corr=0; while corr < N i=i+1; ind=rem(i-1,N)+1; if AugD(ind,:)*a <=0 a=a+AugD(ind,:)'; corr=0; end corr=corr+1; end a_final=a;...
View Full Document

This note was uploaded on 10/26/2009 for the course CMSC 828 taught by Professor Staff during the Fall '05 term at Maryland.

Ask a homework question - tutors are online