Professional Documents
Culture Documents
ร ทฌ เอออวยย
03010896 %2
afreq,xa] = hist(x,50);
wid = xa(2)-xa(1);
figure(1);
subplot(211);bar(xa,afreq);
subplot(212);bar(xa,afreq/(wid*sum(afreq)));
figure(2); Exponentia/
y=normpdf(xa,0,1)
subplot(211);hold on ;plot(xa,y,'m'); figure(3);
÷ PDF แบบ
#
histfit(x,50);
fitdist(x,'Normal')
xcdf = wid*cumsum(afreq)/(wid*sum(afreq));
figure(4);
bar(xa,xcdf);
ycdf = normcdf(xa,0,1);
hold on ;plot(xa,ycdf,'r');
2
วี
ก็
วั
นาย .
ร ทฌ เ อ อวยย
03010896 %2
Exponential
%
•
PDF แบบ
☒
วี
ก็
อื้
วั
นาย .
ร ทฌ เอออวยย
Problem 2: (MATLAB) Explain what these commands do. 03010896 %2
Command Description
rand(5,1)
rand(‘seed’,123)
hist(x,1:6)
hist(x,20)
bar(x,y,0.5)
randi(6,10,1)
normrnd(10,1,1000,1)
normpdf([-3:0.01:3],0,1)
normcdf([-3:0.01:3],0,1)
cumsum([1:10])
random('Normal’,0,1)
histfit(x,20,’Normal’)
fitdist(x,'Normal')
3
วี
ก็
วั
นาย .
ร ทฌ เ อ อวยย
-
ส าง Histogramqosx วง 1 ง 6
ส าง Histogram ของ x แ งเ น 50 อง เ า ๆ น
10,0 =
า นวน ขนาด เออ แก ว 1 ห ก
ส าง PDF บน
Histogram ของ × แ งเ น 20 เ า อง เ า ๆ น
Problem 3: Two persons play a game in which the first player thinks of
a number from 0 to 1 at random, while the second person tries to
guess that number. The second player claims that he is telepathic. In
reality, he just chooses a number a random. What is the probability that
player two will choose a number whose difference from player one’s
number is less than 0.1?
a) Calculate the number theoretically.
b) Simulate this situation in MATLAB and estimate the probability. Also,
turn in your code.
อ 9-.
-
. .
. . .
.
.
r
ะ
Y ✗ +0.1
=
"
ร . i
.
i :
'
- → 4 = ✗ -0.1 i
0.1 _
ih i. ฯ i
า ×
ไ
จะ A- -
{ ☒ 4) ,
ะ
y
-
× t า }
PlA) =
1-2/1 ,
เอ ๚ .
4 ฬู๊
=
0.19 ☒
Pl A) =
0.187 ☒ 4
วี
ก็
ทํ๋
อื้
ด้
วั
นาย .
ร ทฌ เอออวยย
03010896 %2
1/2, 0 x 2
pX (x) =
0, otherwise
(
<latexit sha1_base64="rOsVeTsN+XkgsEI6Fm/LfCh/9vw=">AAACQ3icbVBNb9NAEF0HSlPTUtMee1kRUaVSFewqFVwqReXCMZXIB8RRtN5MklXXa3d3DFhW/huX/oHe+ANcOIBQr0isk1SiDSOt9um9eTO7L0qlMOj735zKo8cbTzarW+7T7Z1nu97zva5JMs2hwxOZ6H7EDEihoIMCJfRTDSyOJPSiy7el3vsE2ohEvcc8hWHMpkpMBGdoqZH30U1HxYd5PT+iZ9QNI5gKVXA70MxdSoNXzWN6SP1QwhXN6eJqhqFV/JIPEb5gkeAM9GdhYO6GoMZ3bnfk1fyGvyi6DoIVqJFVtUfeTThOeBaDQi6ZMYPAT3FYMI2Cy3J6ZiBl/JJNYWChYjGYYbHIYE5fWmZMJ4m2RyFdsP86ChYbk8eR7YwZzsxDrST/pw0ynLwZFkKlGYLiy0WTTFJMaBkoHQsNHGVuAeNa2LdSPmOacbSxlyEED7+8DronjeC04V80a63zVRxVckBekDoJyGvSIu9Im3QIJ1/Jd/KT/HKunR/Ob+d22VpxVp59cq+cP38BJuysbg==</latexit>
1/4, 0 y 4
pY (y) =
0, otherwise
5
วี
ก็
วั
ร ทฌ เ อ อวยย
4) Sd X, 4 เ น สระ อ น ใ Pxylx 4) Pxlx) Py 141
,
= -
นาย .
%2
03 01 0896
จาก Fxylx ๚,
=
Pmltiidtdu
4 2
-
. Px A) .MN dtdo
ะ
1 ะ 1 # dtdu
dtdv
H 11 Ndu
-
}( 2 dvl
Hul :|
=
¥ 1 4)
= 1
{
1 0 t Xt
i 2,0 tyk 4
Fxy (µ)
#
• : =
0 i Otherwise
วี
ก็
ทำ
กั
ต่
อิ
รู๋รู้งั่
รู๋รู้
รู้รฺ
ญํ้
รู้
ป็
อื้
ห้
รู้
วั
นาย .
ร ทฌ เ อ อวยย
03010896 %2
(
2 exp[ (x + y)], 0 y x, x 0
pXY (x, y) =
0, otherwise
จาก Pxlxl =
_
Pyxl Yhxk )
Pxlxkl
•
-
- ะ "
dy X -
✗
e-
_
=
2
"" "
/ำ
×
ะ
-2 e z e-
"
E ; otytx.no
)
ะ
ะ
0-1-2
2 e-
×
☒
6
วี
ก็
รู้
รํ
ยํ๋
อื้
ยื๊
วั
นาย .
ร ทฌ เอออวยย
03010896 %2
Problem 6: Use the result in Slide 28 to prove that if X and Y are
independent standard Gaussian random variables, then X+Y ∼ "(0,2)
Z = ✗+ y
2
✗ 412
-
-
× = ✗ + E- zzxtx
จาก Pz (E) = Px A) Pylz -
× ) dx
-
น =
2×2 + E- ZZX
f ะ dx ( f- ZX t 1 2- 2) Izttz
-
.
= z
¢
-
"" ""
=
2A
1
dx = 21 × -
IZY +
z
tk -
↳ ะeฐึ๋
=
# e- dx
ะ e- (ป แ×
1,1
-
l '
=
e- ¥ E. ~ Nl 0N ☒
7
วี
ฐู้
รั้
ว้
ก็
ญั่
ฐู้
ฐู๋
วู
หั๋
ยั๋
ธื่
บู่
ยํ๋
วั
ยํ๋
ยั้
ตื๋