Matlab: what is the distribution equal to in Matlab code

  • Thread starter Firben
  • Start date
  • #1
145
0

Homework Statement


A common way of displaying the distribution of a random variable is by a histogram. Consider the interval [a,b) divided into M sub-intervals (bins) of length ΔX. Given a set of N random values of x, call Nj the number of values that fall within the jth interval.

Homework Equations


If the expected value of Nj is

<Nj> = N Int(from a+(j-1)Δx to a+jΔx) Px(x) dx ~ NΔx/2[Px(a+(j-1)Δx) + Px(a+jΔx)]

where ΔX = (b-a)/M


where Px(x) is the distribution for x

The Attempt at a Solution



If i want to write a line of code that is the number of particles in a histogram bin of width Δv.

Then what is the Px in Matlab code ? What is it equal to ? If i put Px equal to a arbitrary number say rand(N) then is the line below then correct ?

Nj = (N.*deltaX)./2*rand(1,N); % Number of particles in a histogram of width Δv


 

Answers and Replies

  • #2
18,256
7,928
Thanks for the post! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post?
 

Related Threads on Matlab: what is the distribution equal to in Matlab code

  • Last Post
Replies
5
Views
4K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
14
Views
4K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
1
Views
10K
  • Last Post
Replies
0
Views
4K
  • Last Post
Replies
0
Views
5K
  • Last Post
Replies
7
Views
12K
Replies
1
Views
4K
Replies
3
Views
1K
Top