close all; clear all; clc;
% Number of samples to generate
Nsamps = 100000;
% Set the required second order statistics
P1 = 2.3;
P2 = 0.75;
rho = 0.2 - 1j*0.3;
% 2x2 (theoretical) covariance matrix
Rxx = [P1, sqrt(P1*P2)*rho;
sqrt(P1*P2)*conj(rho), P2]
% Generate zero-mean, unit-power, uncorrelated Gaussian random signals
s1 = randn(1, Nsamps);
s2 = randn(1, Nsamps);
% Create partially correlated signals
x1 = sqrt(P1)*s1;
x2 = sqrt(P2)*(conj(rho)*s1 + sqrt(1-abs(rho)^2)*s2);
% 2x2 (practical) sample covariance matrix
Rxx_samp = [x1;x2]*[x1;x2]' / Nsamps