SNR of original signal and quantized signal - MATLAB - 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.

Related

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;

Strengthening the low amplitude signal using Matlab WITHOUT changing the original shape of the signal

I have a problem in signal processing with Matlab.
I would like to analyze some signal using Matlab but there is a huge difference between the amplitude of signals.
The problem is that the shape of the signal in low amplitude is similar to the shape of the signal in high amplitude. but to analyse the signal, I have to have same range amplitude signal.
how can I have that without destroying the shape and properties of the signal?
Sorry I couldn't send an example plot to clear that.
Something like:
signal1;
signal2;
signal1=(signal1- min(signal1(:))/(max(signal1(:))-min(signal1(:)))
signal2=(signal2- min(signal2(:))/(max(signal2(:))-min(signal2(:)))
% Now both signals are 0-1 range
Without more information this is all what we can offer!

How To Make Noise Signal After Estimate Noise Variance

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.

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)).