discrete joint probability distribution

Hi
I want to build the discrete joint probability distribution for two set of data. data are two groups of random numbers (wind speed) and (wind direction degree). the final results must be like table below.
Pij in the Table are numbers (probability values).
Which function should I use to do this?

 Respuesta aceptada

Peng Liu
Peng Liu el 2 de Oct. de 2016

2 votos

You need to compute the histogram count for every pair (theta_i, v_j), and then normalize it by the sample size. Thus, histcounts2 will help.

2 comentarios

shahrouz Kabiri
shahrouz Kabiri el 4 de Oct. de 2016
ٰDear Peng Liu, I thank you for the response. It works for me.
I just have one more question. In this exact example, my data have 263 unique wind speed values and 352 unique wind direction values. But Matrix N dimensions are 15*13. How can I change the dimensions into my interested values? In the below picture you can see that "Yedges" Parameter has 30 degrees steps starting from 0 and ending in 360. What if I want to have 10 degrees steps?
Peng Liu
Peng Liu el 5 de Oct. de 2016
You can specify any specific edges you want using the syntax: [N,Xedges,Yedges] = histcounts2(X,Y,Xedges,Yedges)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 2 de Oct. de 2016

Comentada:

el 5 de Oct. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by