clear all;, close all;

c=2;
n=400;
x=8.*(rand(2,n)-0.5);
y=x(1,:)-2.*sin(x(2,:));
% add noise
nN=6;
nn=randperm(n);
y(nn(1:nN))=-1.*y(nn(1:nN));

t=zeros(c,n);
t(1,find(y>0))=1;, t(2,find(y<0))=1;

x1=[-4:.1:4];, x2=[-4:.1:4];

figure(1),clf,hold on,box on
figure(1),plot(x(1,find(t(1,:)==1)),x(2,find(t(1,:)==1)),'mo');
figure(1),plot(x(1,find(t(2,:)==1)),x(2,find(t(2,:)==1)),'co');
figure(1),plot(2.*sin(x2),x2,'g--','LineWidth',1.5);
axis square

dlmwrite('sin_data.txt',x,'\t');
dlmwrite('label.txt',t,'\t');
