1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab: what is the distribution equal to in Matlab code

  1. Jun 6, 2015 #1
    1. The problem statement, all variables and given/known data
    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.
    2. Relevant 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

    3. 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


     
  2. jcsd
  3. Jun 11, 2015 #2
    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab: what is the distribution equal to in Matlab code
  1. Matlab code (Replies: 14)

Loading...