Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Statistical distributions

Status
Not open for further replies.

Marco83

Mechanical
Joined
Jun 21, 2006
Messages
8
Location
US
The question is about the Rayleigh random distribution.

If I use the command v=b^2*raylpdf(x,b) with x=[0:0.1:1000]
and b=249 I obtain a maxwellian distribution for the velocity v.

If now I want to do the same thing with the random generator raylrnd using the command v(i)=b^2*raylrnd(b) into a for cycle I obtain a distribution that has the correct shape but the values of v are totaly screwed up. If I omit the b^2 I obtain almost the correct values, but looking at matlab documentation I should include b^2. Is this a bug or am I missing something?

Thanks
 
This is a vectorize mistake.

Try the vewctor notation instead of the scalar. Add a dot everywhere.

Use parens to clarify.

= b .^ 2
is different from
= b ^ 2

Do you want b .^ ( 2 * ralylrnd( b ) )?


jsolar
 
b is a scalar, therefore b.^2 is exactly the same of b^2.
 
Anyway I think I solved the problem myself.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top