如何在 Matlab 中绘制均匀随机变量的 pdf
How to plot pdf of uniform random variables in Matlab
x
和 y
具有均匀分布,我想在 Matlab 中绘制 z
的 pdf。
x ~ U(0,1)
y ~ U(0,1)
Z = (-2.ln(x))^0.5 * cos(2.pi.y)
我该怎么做?
推导 Z 的分布需要一些时间,尽管从 CDF such as P(Z<=z) then condition on X=x or Y=y. Not clear which will be easiest path to eventually get the explicit CDF or PDF. But P(Z<=z|X = x) or P(Z<=z|Y = y) seems best approach. Cross Validated (https://stats.stackexchange.com/) is probably the best place to get the analytical derivation in progress here.
开始可能是最简单的
根据经验,这很容易获得并且样本量足够大,它应该适用于许多应用程序。
N = 5000;
X = rand(N,1);
Y = rand(N,1);
Z = cos(2*pi*Y).*(-2*log(X)).^2;
figure, hold on, box on
histogram(Z,'Normalization','pdf')
如果您想将 Z
视为 (X,Y)
的函数,这些可能会有所帮助。
n = 100;
x = linspace(0,1,n);
y = linspace(0,1,n);
[X,Y] = meshgrid(x,y);
Z = cos(2*pi*Y).*(-2*log(X)).^2;
等高线图不是很有用
但是表面图显示了更多基于 (X,Y)
的情况
x
和 y
具有均匀分布,我想在 Matlab 中绘制 z
的 pdf。
x ~ U(0,1)
y ~ U(0,1)
Z = (-2.ln(x))^0.5 * cos(2.pi.y)
我该怎么做?
推导 Z 的分布需要一些时间,尽管从 CDF such as P(Z<=z) then condition on X=x or Y=y. Not clear which will be easiest path to eventually get the explicit CDF or PDF. But P(Z<=z|X = x) or P(Z<=z|Y = y) seems best approach. Cross Validated (https://stats.stackexchange.com/) is probably the best place to get the analytical derivation in progress here.
开始可能是最简单的根据经验,这很容易获得并且样本量足够大,它应该适用于许多应用程序。
N = 5000;
X = rand(N,1);
Y = rand(N,1);
Z = cos(2*pi*Y).*(-2*log(X)).^2;
figure, hold on, box on
histogram(Z,'Normalization','pdf')
如果您想将 Z
视为 (X,Y)
的函数,这些可能会有所帮助。
n = 100;
x = linspace(0,1,n);
y = linspace(0,1,n);
[X,Y] = meshgrid(x,y);
Z = cos(2*pi*Y).*(-2*log(X)).^2;
等高线图不是很有用
但是表面图显示了更多基于 (X,Y)
的情况