Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Some problems about Box-Muller Transformation...

Status
Not open for further replies.

shaq

Full Member level 5
Joined
Jul 23, 2005
Messages
311
Helped
14
Reputation
28
Reaction score
4
Trophy points
1,298
Activity points
3,397
box muller matlab

Hello everyone,

We know that Box-Muller method is to transfer uniform distribution to normal distribution.

For more information, pls contact this site:
https://mathworld.wolfram.com/Box-MullerTransformation.html

Now, I have a little problem.

I want to plot the result of using Box-Muller method in Matlab by using surf( ).

I have a short code about Box-Muller method, but the result is histogram figure.

%%%%%%Code Starts%%%%%%%%%%%
for i=1:10000
u1=rand(1);
u2=rand(1);
x1=sqrt(-2*log(u1))*cos(2*pi*u2);
x2=sqrt(-2*log(u2))*sin(2*pi*u1);
rv1(i,1)=x1;
rv2(i,1)=x2;
end
rv=[rv1;rv2];
x = -3:0.1:3;
hist(rv,x)
%%%%%%Code Ends%%%%%%%%%%%%

Can anyone help me to modify this code to display 3D figure?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top