フィルターのクリア

I want to estimate bivariate normal distribution and having trouble estimating it. How can i make it possible?

5 ビュー (過去 30 日間)
i want to estimate nomal probability density function of 2 variables (i.e. bivariate normal distribution ). i used this formula from Wikipedia:
my variables 'x' and 'y' are:
I write this code:
Covariance_matrix = cov(x,y); % estimated ro,sigma1 and sigma2 using this
ro = -0.0717;
mu1 = 0.1068;
mu2 = 0.8556;
sigma1 = 1.3250e-04;
sigma2 = 9.1330e-04;
sd1 = 0.0115;
sd2 = 0.0302;
Pdf = 1/(2*pi*sd1*sd2*sqrt(1-(ro^2))) * exp(-1/2*(1-ro^2)) * ((((x-mu1)/sigma1).^2) + (((y-mu2)/sigma2).^2)) - (2*ro*((x-mu1)*(y-mu2)/sd1*sd2));
My result is:
first of all i want to know am i going write and my second question is that i learnt probability ranges between 0 and 1 but in this case probability density values are very high so how is it possible? Please help.

回答 (1 件)

Image Analyst
Image Analyst 2014 年 10 月 10 日
You tried to do too much in one line and messed up the parentheses. Split it apart into separate terms so that doesn't happen:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
format compact;
xl = linspace(-2, 2, 30);
yl = linspace(-2, 2, 30);
[x,y] = meshgrid(xl,yl);
Covariance_matrix = cov(x,y) % estimated ro,sigma1 and sigma2 using this
rho = -0.0717;
mu1 = 0.1068;
mu2 = 0.8556;
sigmaX = .51;
sigmaY = .91;
amplitude = 1 / (2 * pi* sigmaX * sigmaY * sqrt(1-rho^2))
factor = -1 / (2 * (1-rho^2))
term1 = ((x - mu1) / sigmaX) .^ 2;
term2 = ((y - mu2) / sigmaY) .^ 2;
term3 = 2 * rho * (x-mu1) * (y-mu2) / (sigmaX * sigmaY);
Pdf = amplitude * exp(factor * (term1 + term2 - term3));
surf(Pdf)
  4 件のコメント
PRAKASH JOSHI
PRAKASH JOSHI 2022 年 7 月 21 日
How do we change the angle of the bivariate gaussian, i m not able to change the angle of bivariate gaussian
Image Analyst
Image Analyst 2022 年 7 月 21 日
@PRAKASH JOSHI I'd probably take the result above and multiply it by a Rotation Matrix:

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by