Professional Documents
Culture Documents
1.b) % Generate Data Set
1.b) % Generate Data Set
b)
% Generate Data Set
rng(1);
full_data = [];
xrange = 5;
for i = 1:50
x1 = xrange * rand(1,1);
x2 = xrange * rand(1,1);
x2 = x2 + 0.25;
z = 1;
else
x2 = x2 - 0.25;
z = 0;
end
end
data_Train = full_data(1:40,:);
data_Test = full_data(40:50,:);
figure(1);
plotpv([full_data(:,1)'; full_data(:,2)'],full_data(:,3)');
axis([-1 6 -1 6]);
set(gcf, 'Position', [100, 100, 750, 350]);
% Initialize Input Vector with Training Dataset
tList = data_Train(:,3)';
plotpv(pList,tList);
hold on;
plot(mdl.SupportVectors);