看板 MATLAB 關於我們 聯絡資訊
我們一般要畫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