function sampleImage

x = -100:100;
y = -100:100;
[X, Y] = ndgrid(x, y);
A = 1; B = 2;
V = 6* pi / 201;
W = 4* pi / 201;
F = A * sin(V*X) + B * cos(W*Y);

xx = -100:10:100;
yy = -100:10:100;
[XX , YY] = ndgrid (xx , yy );

%exact derivative
Fx = V * A * cos(V*XX);
Fy = W * B * -sin(W*YY);

subplot(1,2,1), imshow(F, [], 'xData', x, 'yData', y);
hold on;
subplot(1,2,1), quiver (yy , xx , Fy , Fx , 'g');
hold off;

%sample F every 10 pixels in both directions:
G = A * sin(V*XX) + B * cos(W*YY);
%approximate derivative with gaussian derivative
Gx = gD(G, 1, 1, 0);
Gy = gD(G, 1, 0, 1);

subplot(1,2,2), imshow(F, []);
hold on;
% 105 is a nice number.
subplot(1,2,2), quiver(yy+105, xx+105, Gx, Gy , 'r');
%subplot(2,2,2), quiver(yy+105, xx+105, Gx, Gy , 'r');
%subplot(1,2,2), quiver(yy, xx, Gx, Gy' , 'r');
