function [darkfield,clearfield] = simulateNoise(v1,g1,v2,g2,imSize)
%SIMULATENOISE Summary of this function goes here
%   Detailed explanation goes here
[X,Y] = meshgrid(1:imSize(2),1:imSize(1));

darkfield = 1/imSize(2)/2*X + 0.7/imSize(1)/2*Y;
% add noise
darkfield = imnoise(darkfield,'gaussian',0,g1)*v1;


A = 1;
x0 = imSize(2)/2; y0 = imSize(1)/2;

sigma_X = imSize(2)/2;
sigma_Y = imSize(1)/2;


% https://en.wikipedia.org/wiki/Gaussian_function
for theta = 0:pi/100:pi
    a = cos(theta)^2/(2*sigma_X^2) + sin(theta)^2/(2*sigma_Y^2);
    b = -sin(2*theta)/(4*sigma_X^2) + sin(2*theta)/(4*sigma_Y^2);
    c = sin(theta)^2/(2*sigma_X^2) + cos(theta)^2/(2*sigma_Y^2);

    clearfield = A*exp( - (a*(X-x0).^2 + 2*b*(X-x0).*(Y-y0) + c*(Y-y0).^2));
end

clearfield = imnoise(clearfield,'gaussian',0,g2)*v2+darkfield;
end

