Search code examples
matlabchi-squaredprobability-distribution

Plot the PMF given the realizations of a certain random variable on MATLAB


I have an array with a certain number of realizations of a test.

I need to plot the PMF given my realizations

I've read this Q&A but I think in my case, to build the PMF I first need to find the frequency so the values ​​fall within a certain range (like [-1,0],[0,1], etc) but I can't figure out how to do it in a fast way.


Solution

  • In my case, the solution was to use the command

    histogram(X,'Normalization','pdf')
    

    which plot what I was looking for; X is my column vectors containing the realizations