[問題] 如何對uniform distri.的樣本求pdf

看板MATLAB作者 (赴美留學的日子...)時間12年前 (2013/10/10 15:50), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
我們一般要畫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

10/12 03:26, , 1F
figure, hist(x)
10/12 03:26, 1F

10/13 05:28, , 2F
感謝樓上!!
10/13 05:28, 2F
文章代碼(AID): #1ILbmhAP (MATLAB)
文章代碼(AID): #1ILbmhAP (MATLAB)