% eda03_11
% Illustrate a joint Normal distribution

% set up vectors da and d2
L=40;
Dd = 1.0;
d1 = Dd*[0:L-1]';
d2 = Dd*[0:L-1]';

% make a Normal distribution
d1bar=15;
d2bar=25;
s1=3;
s2=5;
norm=1/(2*pi*s1*s2);
p1=exp(-((d1-d1bar).^2)/(2*s1*s1));
p2=exp(-((d2-d2bar).^2)/(2*s2*s2));
P=norm*p1*p2';

% Set up graphics
figure(1);
clf;
axis([-L/8, 15*L/8, -L/8, 15*L/8]);
hold on;
axis equal;
set(gca,'XTick',[]); % turn off horizontal axis
set(gca,'YTick',[]); % turn off vertical axis

bw=0.9*(256-linspace(0,255,256)')/256;
colormap([bw,bw,bw]);

% use simple drawing function that encapsulates all the graphics
eda_draw(P,'caption p(d1,d2)');

