histogram2 versus mvnpdf
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sylvia
el 18 de Feb. de 2020
Comentada: Sylvia
el 23 de Feb. de 2020
I have two variables and would like to create a joint PDF. I am mainly interested in the shape of the PDF and not the actual probability. My variables are two column arrays: u and v. I first tried using histrogram2(u, v), but was unsure if that was the correct function to use. I then tried using the mvnpdf function to check. I tried JPDF = mvnpdf( [u ,v] ). I then plotted the result with scatter3(u,v,JPDF). I got a different shaped distribution curve than the histrogram2 curve. Can anyone explain why they would produce different shaped curves?
0 comentarios
Respuesta aceptada
Raunak Gupta
el 21 de Feb. de 2020
Hi,
The mvnpdf estimates the pdf value of each pair of variables with respect to zero mean and identity covariance matrix d-dimensional gaussian distribution where d is the number of variables. So, it uses the formula of multivariate normal distribution for calculation of those pdf values.
Whereas histogram2 just distributes the x and y variables as coordinates into the bins specified by the range of x and y variables and the number of bins.
So, the difference between the two is mvnpdf will give exact value according to multivariate normal distribution only while histogram2 will give the exact shape of the distribution based on the count of variables in specific range. For getting exact shape it requires data to be coming to all bins in histogram2 and there are enough instances of variable representing the distribution accurately.
Más respuestas (0)
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!