This repository has been archived on 2021-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
NC/mp4/Project_4_Maggioni_Claudio/datasets/halfkernel.m
Claudio Maggioni (maggicl) 34b290c569 mp4: done 1a-c in MATLAB
2020-11-04 14:59:14 +01:00

32 lines
No EOL
689 B
Matlab
Executable file

function data = halfkernel(N, minx, r1, r2, noise, ratio)
if nargin < 1
N = 1000;
end
if mod(N,2) ~= 0
N = N + 1;
end
if nargin < 2
minx = -20;
end
if nargin < 3
r1 = 20;
end
if nargin < 4
r2 = 35;
end
if nargin < 5
noise = 4;
end
if nargin < 6
ratio = 0.6;
end
phi1 = rand(N/2,1) * pi;
inner = [minx + r1 * sin(phi1) - .5 * noise + noise * rand(N/2,1) r1 * ratio * cos(phi1) - .5 * noise + noise * rand(N/2,1) ones(N/2,1)];
phi2 = rand(N/2,1) * pi;
outer = [minx + r2 * sin(phi2) - .5 * noise + noise * rand(N/2,1) r2 * ratio * cos(phi2) - .5 * noise + noise * rand(N/2,1) zeros(N/2,1)];
data = [inner/4; outer/4];
end