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.

uniformly distributed random number from 0 to 2*pi in MATLAB

Status
Not open for further replies.

vickyuet

Member level 2
Joined
Oct 3, 2006
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
pakistan
Activity points
1,691
Rand generates uniformly distributed random values between [0 to 1], but I need values from [0 to 2*pi].Is there any method to explicitly force rand to generate values from above desired range instead of default [0 to 1]?.I had tried
Angle = (2*pi) * rand(1,10)
but not convinced.Any other approach or function to do this….
 
Last edited:

Re: uniformlydistributed random number from 0 to 2*pi in MATLAB

Angle = (2*pi) * rand(1,10) is correct why aren't you convinced ?
 

That's the way to do it. What's wrong?
 

I want a function that take an argument(as limits like 0 to 2pi) .....If there is any option to change rand to overwrite values from 0 t0 1 as 0 to 2pi.....some thing like

rand(1,10,0,2*pi) % to generate 1x10 row vector all values from 0 t0 2pi instead 0 t0 1....

- - - Updated - - -

I want a function that take an argument(as limits like 0 to 2pi) .....If there is any option to change rand to overwrite values from 0 t0 1 as 0 to 2pi.....some thing like

rand(1,10,0,2*pi) % to generate 1x10 row vector all values from 0 t0 2pi instead 0 t0 1....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top