Clear Filters
Clear Filters

Create narrowband complex signal snapshots and normalize them.

12 views (last 30 days)
I want to create narrowband complex signal snapshots (for example 100) with a specific signal power (Ps). Then I want to normalize the samples. K is the number of source signals and L is the number of snapshots. For example:
s = randn(K,L) + 1j*randn(K,L)
What should I multiply or divide the signal s with to obtain a normalized signal? and why? Assume that Ps = 1 W
normalized_signal = ???? * randn(K,L) + 1j*randn(K,L)

Answers (1)

Ayush
Ayush on 4 Jan 2024
Hi @Yara
I understand that you want to obtain a normalized signal from s. The signal s is generated by randn(K,L) for the real part and 1j*randn(K,L) for the imaginary part. Each element of randn(K,L) is a sample from a normal distribution with mean 0 and variance 1. The power of this signal would be 1 (since variance is a measure of power for a zero-mean signal), but since you have both real and imaginary parts, the total power would be 2.
To normalize this signal to have power Ps, you need to scale it such that its new average power is Ps. You would scale the signal by the square root of Ps/2 to normalize its power to Ps.
Here is the conceptual code for that:
K = ...; % Number of source signals
L = ...; % Number of snapshots
Ps = 1; % Desired signal power in Watts
% Generate the complex signal
s = randn(K,L) + 1j*randn(K,L);
% Calculate the scaling factor to normalize the signal to power Ps
scaling_factor = sqrt(Ps/2);
% Apply the scaling factor to the signal
normalized_signal = scaling_factor * s;
Thanks,
Ayush
  4 Comments
Yara
Yara on 4 Jan 2024
Thank you @Ayush!
I would like to ask another question in this area:
I want to generate colored noise samples given the noise covariance matrix and the SNR. I assumed that the source signal power is Ps = 1 W and hence find the noise power Pn. The noise covariance matrix is:
Qm,l = σn^2 * exp{−0.5(m − l)^2}
where m and l are indices of the covariance matrix Q (9 x 9) and σn is the noise variance (hence σn = Pn).
How can I generate noise samples from this given information and how to normalize them?
Ayush
Ayush on 9 Jan 2024
You may try this code:
% Given parameters
Ps = 1; % Source signal power in watts (W)
SNR = 10; % Signal-to-Noise Ratio (SNR) in dB
% Convert SNR from dB to linear scale
SNR_linear = 10^(SNR / 10);
% Calculate noise power Pn based on SNR
Pn = Ps / SNR_linear;
% Noise variance (sigma_n squared)
sigma_n_squared = Pn;
% Construct the noise covariance matrix Q (9x9)
matrixSize = 9;
Q = zeros(matrixSize, matrixSize);
for m = 1:matrixSize
for l = 1:matrixSize
Q(m, l) = sigma_n_squared * exp(-0.5 * (m - l)^2);
end
end
% Generate noise samples from the multivariate normal distribution
numSamples = 1000; % Number of noise samples to generate
noiseSamples = mvnrnd(zeros(matrixSize, 1), Q, numSamples);
% Normalize the generated noise samples if necessary
% Here we normalize the samples so that the sample covariance matches Q
sampleCov = cov(noiseSamples);
normalizationFactor = sqrt(Q ./ sampleCov);
normalizedNoiseSamples = noiseSamples .* normalizationFactor;
% Note: The normalization step assumes that the noise samples are centered
% around zero and that we want to scale them to have the same variance as
% specified by Q. The normalization factor is computed as the square root
% of the ratio between the desired covariance matrix Q and the actual
% sample covariance of the generated noise samples.
% Check if the normalization is successful
normalizedSampleCov = cov(normalizedNoiseSamples);
disp('Normalized Sample Covariance Matrix:');
disp(normalizedSampleCov);
Thanks,
Ayush

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!