Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK 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
Jun 21, 2006
8
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
 
Replies continue below

Recommended for you

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