I need ziggurat matlab code to draw
4 views (last 30 days)
Show older comments
Hello, i need a ziggurat matlab code to generate somehing like this
i'm working with (gauss) random number generator ziggurat rejection method
0 Comments
Accepted Answer
Chunru
on 17 May 2022
Edited: Chunru
on 17 May 2022
where is a normalizing constant that we can ignore.
x = [0:.1:2]
y = 1/(2*pi)*exp(-x.^2/2);
stairs(x, y, 'b');
hold on
xl = xlim;
plot([xl(1)*ones(1, length(x)-1); x(2:end)], [y(2:end); y(2:end)], 'b')
% longer tais
x = [0:.1:4]
y = 1/(2*pi)*exp(-x.^2/2);
plot(x, y, 'r')
8 Comments
More Answers (0)
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!