I have values from a Monte Carlo simulation. now I am supposed to plot the results using a bivariate Gaussian. Since it is experimental data on a specific topic, I was given the empirical formula of the PDF(x,y):
and this is the plot I should get( obviously it will be different depending on my data):
I don't understand how to implement the plot
This is the part of the code where I calculate STD, means:
N=5000
x=randn(N,1); %along-track direction [Nx1]
y=randn(N,1); %cross-track direction [Nx1]
mu_x=mean(x);
mu_y=mean(y);
Delta_x= x-mu_x;
Delta_y= y-mu_y;
rho_xy= 0; %termine di correlazione ipotizzato nullo
% STD calcolate dalla sola posizione geometrica dei punti di caduta
sigma_x= sqrt(1/N*sum((x-mu_x).^2))
sigma_y= sqrt(1/N*sum((y-mu_y).^2))
%valutazione pdf
term1 = 1/((2 * pi* sigma_x * sigma_y )*(sqrt(1-rho_xy^2)));
term2 = -1/(2*(1-rho_xy^2));
term3 = (Delta_x / sigma_x) .^ 2;
term4 = (Delta_y / sigma_y) .^ 2;
term5 = -2 *rho_xy*Delta_x.*Delta_y/(sigma_x*sigma_y);
Pdf = term1 * exp(term2 * (term3 + term4 + term5))
I'll probably have to use the histogram2
command, and I saw that in the properties there is a 'pdf'
option. I would like to insert the pdf that I calculated, though. How can I do that?