Followings are the code that I wrote in Octave to creates all the plots shown in this page. You may copy these code and play with these codes. Change variables and try yourself until you get your own intuitive understanding.
< Code 1 >
x = -3:0.1:3;
pi = 3.14159
m = 0;
s = 1;
y = 1/sqrt(2*pi*s^2)*exp(-(x-m).^2/(2*s^2));
plot(x,y,'b-','Linewidth',2);
ylim([0 0.5]);
grid on;
< Code 2 >
x = -3:0.1:3;
pi = 3.14159
mList = [-1.0 0.0 1.0];
s = 1;
hold on;
for m = mList
y = 1/sqrt(2*pi*s^2)*exp(-(x-m).^2/(2*s^2));
plot(x,y,'b-','linewidth',2); grid on; xlabel('x'); ylabel('y');
end;
ylim([0 0.5]);
hold off;
< Code 3 >
x = -3:0.1:3;
pi = 3.14159
m = 0;
sList = [0.5 1.0 1.5];
s = 1;
hold on;
for s = sList
y = 1/sqrt(2*pi*s^2)*exp(-(x-m).^2/(2*s^2));
plot(x,y,'b-','linewidth',2); grid on; xlabel('x'); ylabel('y');
end;
ylim([0 1.0]);
hold off;
|