You are on page 1of 3

Task 4: "Two bivariate Gaussian distribution"

% two bivariate gaussian signals


clc;
clear all;
close all;
mu1=[2,2];
mu2=[-1,2];
sigma1=[2 1.5; 1.5 4];
sigma2=[1 2; 2 5];
n=10000;


m1=mvnrnd(mu1,sigma1,n);
m2=mvnrnd(mu2,sigma2,n);

m=[m1;m2];

nbins=[25,25];

% figure(1)
% hist3(m1,nbins)
% figure(2)
% hist3(m2,nbins)

%level 2 decomposition
[c11,l11]=wavedec(m(:,1),2,'haar');
[c21,l21]=wavedec(m(:,2),2,'haar');
ca1=c11(1:l11(1));
ca2=c21(1:l21(1));
C1=[ca1,ca2];
figure(3)
subplot(2,2,1)
contour(hist3(m,nbins))
title('contour plot of original pdf')
xlabel('bins');ylabel('bins');
subplot(2,2,2)
contour(hist3(C1,nbins))
title('contour plot of pdf of appcoef at level2 ')
xlabel('bins');ylabel('bins');

%level 3 decomposition
[c12,l13]=wavedec(m(:,1),3,'haar');
[c22,l23]=wavedec(m(:,2),3,'haar');
ca3=c12(1:l13(1));
ca4=c22(1:l23(1));
C2=[ca3,ca4];
subplot(2,2,3)
contour(hist3(C2,nbins))
title('contour plot of pdf of appcoef at level3 ')
xlabel('bins');ylabel('bins');

%level 4 decomposition
[c13,l14]=wavedec(m(:,1),4,'haar');
[c23,l24]=wavedec(m(:,2),4,'haar');
ca5=c13(1:l14(1));
ca6=c23(1:l24(1));
C3=[ca5,ca6];
subplot(2,2,4)
contour(hist3(C3,nbins))
title('contour plot of pdf of appcoef at level4 ')
xlabel('bins');ylabel('bins');


figure(4)
subplot(2,2,1)
contour3(hist3(m,nbins))
title('3D contour plot of original pdf')
xlabel('bins');ylabel('bins');
subplot(2,2,2)
contour3(hist3(C1,nbins))
title('3D contour plot of pdf of appcoef at level2 ')
xlabel('bins');ylabel('bins');

subplot(2,2,3)
contour3(hist3(C2,nbins))
title('3D contour plot of pdf of appcoef at level3 ')
xlabel('bins');ylabel('bins');

subplot(2,2,4)
contour3(hist3(C3,nbins))
title('3D contour plot of pdf of appcoef at level4 ')
xlabel('bins');ylabel('bins');



Fig: Contour plot of pdf at various level of decomposition


Fig: 3D Contour plot of pdf at various level of decomposition
Conclusion: Using wavelet in class separation of two bivariate Gaussian variables

You might also like