function [X, Y] = gen_nonlindata(N=2000, rad=10, thk=5, sep=5) setenv("GNUTERM", "x11") # semicirculo positivo p = 500; N = N/2; x = [(rad + thk) * rand(p * N, 1); - (rad + thk) * rand(p * N, 1)]; y = [(rad + thk) * rand(2 * p * N, 1)]; perm = randperm(2 * p * N); x = x(perm, :); y = y(perm, :); idx = find(sqrt(x.^2 + y.^2) <= rad + thk & sqrt(x.^2 + y.^2) >= rad); x = x(idx(1:N), :); y = y(idx(1:N), :); X = [ones(N, 1), x, y]; Y = -1 * ones(N, 1); plot(x, y, 'ro') # semicirculo negativo x = [(rad + thk) * rand(p * N, 1); - (rad + thk) * rand(p * N, 1)]; y = -1 * [(rad + thk) * rand(2 * p * N, 1)]; perm = randperm(2 * p * N); x = x(perm, :); y = y(perm, :); idx = find(sqrt(x.^2 + y.^2) <= rad + thk & sqrt(x.^2 + y.^2) >= rad); x = x(idx(1:N), :) + rad + thk/2; y = y(idx(1:N), :) - sep; hold on plot(x, y, 'b+') hold off X = [X; ones(N, 1), x, y]; Y = [Y; +1 * ones(N, 1)]; perm = randperm(2*N); X = X(perm, :); Y = Y(perm, :); end