From: Chih How on 8 Feb 2010 18:54 I have a bunch of data which I try to fit into a bivariate gaussian distribution as shown in the code below. The problem I face now is I don't know how to plot a gaussian contour to overlap on the data. Any help will be appreciated. Attached the code, X = rand(100,2) [n,d] =size(X) scatter(X(:,1),X(:,2)) hold on mu = mean(X) X = X - ones(n,1)*mu sigma = cov(X) F = mvnpdf(X,mu,sigma) %plot contour here gauss = mvnrnd(mu,sigma,1000) scatter(gauss(:,1),gauss(:,2))
|
Pages: 1 Prev: Prediction for ARMAX model Next: [Time series] everything in one column. Need matrix. |