0
$\begingroup$

I'm studying a system's transient characteristics with awgn added to an input signal and I need to calculate $\text{SNR}$ before and after filtration.

Here is my code to generate input and output:

K0=1.2;
b=[0 K0];
a=[1 K0-1];
N=10000;
n=1:N;
uinp=[1 ones(1,N-1)];
sn=0   ;               % SNR on input signal
levs=0  ;              
uinp=awgn(uinp,sn,levs);   
uout=filter(b, a, uinp);

The input signal has an $\text{SNR}$ equal to $1$ (or $0\, \text{dB}$).
How can I calculate the $\text{SNR}$ of the output signal?

I've tried to calculate the noise power (as without noise, the mean equals 1 after the transient, so I can just divide), but not sure if it is correct:

sum((uout-mean(uout)).^2)/length(uout) % = 1.5366
sum((uinp-mean(uinp)).^2)/length(uinp) %= 1.0236
$\endgroup$

1 Answer 1

0
$\begingroup$

What about the MATLAB SNR Function?

$\endgroup$
3
  • $\begingroup$ I've tried it, assuming that f(signal+noise)=f(signal)+f(noise) where f is a filter function. Looks true enough, but I'm not sure $\endgroup$
    – lazba
    Oct 25, 2022 at 4:07
  • $\begingroup$ There's a lot to unpack here. My advice is to run the examples that MATLAB provides for awgn() and snr(). $\endgroup$
    – user58975
    Oct 25, 2022 at 4:41
  • 1
    $\begingroup$ I've did it using snr(signal,noise), where signal is if filter signal without noise, and noise is filter noisedSignal-clearSignal $\endgroup$
    – lazba
    Oct 26, 2022 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.