X = randn(2,1000); %produce random inputs in 2d w = [1;1]; %define some linear function n = randn(1,1000)*0.1; %produce noise in 1d Y = w'*X + n; %apply function and add noise scatter3(X(1,:),X(2,:),Y); %show the result