How To Make Noise Signal After Estimate Noise Variance - matlab

For Blind Source Separation (Adapative Filtering , LMS Algorithm), i need two input. a)noisy signal, 2)noise signal. But How can i make the noise signal. If i can estimate the noise variance of noisy signal, then how can i make a noise signal from noise variance in matlab. I am new in signal processing.

try this (matlab):
noise = normrnd(mean ,sqrt(variance) ,rows ,columns);
it will generate random numbers from the normal distribution (mean,variance).
rows and columns will dictate the result matrix dimensions.

Related

SNR of original signal and quantized signal - MATLAB

If I wanted to get the SNR of a quantized audio signal, would I subtract the quantized signal from the original (which would give me the noise?) and then calculate the power of this noise and compare it to the power of the original signal?
Such as, SNR(dB)=10*log(original power/noise power)
Yes, that is the quantization noise. It is not just “noise” because the input has noise as well, and you don’t include that noise in your result.

Signal Detection Variance of Noise when signal is not present

I am trying to use Matlab to simulate detection of signal, and the amplitude of signal is either 1 or 0. However, after the AWGN channel, I need to generate the white noise, and I know the variance of noise is proportional to the amplitude of signal for a given SNR. However, if my amplitude is 0, does that mean my variance of noise if 0? If that is true, then there will be no false alarm probability. If that is not true, then how do I calculate the variance of noise?
The SNR is a ratio of the average power of the signal and the average power of the noise.
So in your example the signal is 0 and 1 and roughly half the time (if the data is independent and identically distributed, iid). Then the power would be:
0.5*0+0.5*1=0.5
so no the SNR is a ration between the 0.5 and the power of the noise.
Normally during the detection you would decide on a threshold, e.g. 0.5. If the detected signal is below the threshold you would decide on a 0 and if it is above you would decide on 1.

Attaining desired input snr in noisy signal

I have taken a clean speech signal and need to get an input SNR of 0dB, 5dB and 10dB by adding certain amount of white noise.
Can anyone explain what 0dB, 5dB... is? Is it the power of white noise in the command
noise=wgn(1,20115,0);
and if not, how do I achieve input SNR of 0dB, 5dB and 10dB?
The signal to noise ratio (SNR) is the signal power relative to the noise power. The easiest way to achieve a given SNR while adding White Gaussian Noise to a clean signal is with awgn:
input_snr_db = 5; % Choose input SNR in dB
noisy_signal = awgn(clean_signal, input_snr_db, 'measured');
This computes the required level of noise given a signal which may not have unitary power.

Noise Comparison in MATLAB

Assuming I have two signals (raw data as excel file) measured from two different power supplies, I want to compare the noise-levels of these signals to find out which one of them the noisier one. Both power supplies produce signals with the same frequency but the amount of data points are different. Is there a way to do this in MATLAB?
You could calculate the signal-to-noise ratio for each signal. This is just a ratio of the average signal power and average noise power, usually measured in decibels. An ideal noiseless signal would have SNR = infinity.
Recall that signal power is just the square of the signal amplitude, and to get the value x in decibels, we just take 10*log10(x).
SNR = 10*log10( mean(signal.^2)/mean(noise.^2) );
To separate the signal from the noise, you could run a low-pass filter over the noisy signal.
To get the noise you could just subtract the clean signal from the noisy signal.
noise = noisy_signal - signal;

How to calculate user defined SNR, given only sampling frequency and a vector containing signal samples?

So I have the samples (hex values) of a sinus signal and I know the sampling frequency. Using this I can plot an fft or periodogram but then I would like to find out the SNR ratio. What would be the most accurate way to calculate the noise and signal power? I would prefer doing it in frequency domain. Is there a way to do this also in time domain?
Thanks a lot in advance!!!
So if there is noise on your signal and you know that your underlying signal is a sine wave, you can easily get your signal parameters i.e. amplitude,frequency and phase by least squares. If y(t) is your signal just minimize the L2 norm of (y(t)-A.sin(wt+b)) over A,w and b. Then you can easily get signal power from the underlying signal and the noise power from the error signal (y(t)-A.sin(wt+b)).