ekpirical histogram of a density function

  • Follow


Hi,
I have 10000 realizations of a 50-dimensional vector X. i.e. I have X1, X2,...X10000, each of size 50x1. How to plot the empirical histogram of density function of X??
My understanding:
1. Find the mean of 10000 samples. We get a 50 dimensional vector X_mean. 
2. Find the covariance of 10000 samples. We get 50x50 dimensional matrix X_cov.
3. Fit a Gaussian distribution with X_mean and X_cov.
4. Draw a 50-dimensional sample X_sample from the Gaussian distribution.
5. [f,x] = ecdf(X_sample).
6. ecdfhist(f,x)

Is this approach correct???
Thanks.
0
Reply kwzeet (45) 6/9/2012 3:06:57 AM

kumar vishwajeet
How is that a 50 dimensional array?  It seems to me to be a 2 dimensional array where each row of X could contain one of your X1, X2, etc. vectors.  So your X matrix would be 10000 rows by 50 columns.  That is a 2D matrix.  To get the mean of each row, you'd do

meanOfRows = mean(X, 2); % Take mean of each row going along the 50 columns.

If you want the probability density function of X I'm not sure why you're doing the covariance.  Why not just take the hist of the whole thing and normalize:
pdfX = hist(X) / numel(X);
0
Reply imageanalyst (7596) 6/9/2012 3:54:17 AM


1 Replies
47 Views

(page loaded in 0.068 seconds)


Reply: