Create narrowband complex signal snapshots and normalize them.
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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)
0 Commenti
Risposte (1)
Ayush
il 4 Gen 2024
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 Commenti
Ayush
il 9 Gen 2024
Hi @Yara
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
Vedere anche
Categorie
Scopri di più su Lifting in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!