作者sleeeve (赴美留學的日子...)
看板MATLAB
標題[問題] 如何對uniform distri.的樣本求pdf
時間Thu Oct 10 15:49:58 2013
我們一般要畫uniform distribution的pdf都是這樣:
x = 0:0.001:7;
y = unifpdf(x, 1, 6);
plot(x,y)
(1,6)是random variable的定義區間。 0~7是圖形的橫坐標範圍。
今天,如果random variable不是直接給一個區間,而是這樣:
n=400;
radius = 1;
xc = 0;
theta = rand(1,n)*(2*pi);
r = sqrt(rand(1,n))*radius;
x = xc + r.*cos(theta);
x在[-1 1]這區間有400個點均勻的分布。想求其pdf...那然後畫出來...要怎麼做呢?
還可以用unifpdf函數嗎?
thanks
--
╭──╮ 全 q ˙ . 全 ╭════╮
║ 燈 電 世 . 潘 ◤◥◤◥ 陽 街 世 │此路不通│
║││ 了 界 ˙威 在 一 起 建 . 了 界 ╰═ ╤ ═╯
║ 停 都 ‧ 倫 ◣ ◢ 福 . 封 都 │
║ ﹕. ˙ ‧ ‧ │
███ ψsleeeve ███
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 50.135.126.40
推 jatj:figure, hist(x) 10/12 03:26
→ sleeeve:感謝樓上!! 10/13 05:28