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.

Need Matlab code for box muller

Status
Not open for further replies.

mvenkat3272

Newbie level 5
Joined
Aug 11, 2006
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
Could anybody give me the codes for box muller or any other noise generation algorithm or at least give me the links from where to download them?
 

mvenkat3272

Newbie level 5
Joined
Aug 11, 2006
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
Re: Matlab code

i have tried that and i did not get any specific hits during searches
 

vishnu.cse60

Newbie level 1
Joined
Jan 19, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
INDIA
Activity points
1,287
code 1:

r = rand(1000,2); % 2 cols of uniform rand
% Do the Box-Muller transformation
n = sqrt(-2*log(r:),1)))*[1,1].*[cos(2*pi*r:),2)), sin(2*pi*r:),2))];
hist(n) % plot two histograms

code 2:
function x=boxmuller(n,sd);

x=zeros(n,1);

len=ceil(n/2);
rand('seed',sd);

for i=1:len
u1=rand(1,1);
u2=rand(1,1);
x(i)=sqrt(-2*log(u1))*cos(2*pi*u2);
if (i+len<=n)
x(i+len)=sqrt(-2*log(u1))*sin(2*pi*u2);
end;
end;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top