computing SNR in matlab

1 view (last 30 days)
Bahareh
Bahareh on 7 Jan 2012
Hello all,
I have a noisy sinisoid signal and would like to compute its SNR in MATLAB. Can anybody help me? Thanks.

Answers (1)

Rick Rosson
Rick Rosson on 7 Jan 2012
  1. What is the amplitude of the sine wave?
  2. Is the noise additive white Gaussian or some other type? If Gaussian, what is the mean and standard deviation?
  1 Comment
Bahareh
Bahareh on 7 Jan 2012
Here is my code. I actually want to find the SNR of my output filter 'yf'. I was wondering if you could please help me.
{
dt = 1/5e4;fs=1/dt;
t1=cos(2*pi*1e3*(0:dt:6e-3));
t2=cos(2*pi*2e3*(0:dt:6e-3));
t3=cos(2*pi*3.5e3*(0:dt:6e-3));
t4=3*cos(2*pi*20e3*(linspace(2e-3,2.1e-3,length(t3))));
x=t1+t2+t3+t4;
y=awgn(x,10,'measured');
wpass=2*1e4/fs; wstop=2*2e4/fs; %normalized passband & stopband frequencies
[N,wn]=buttord(wpass,wstop,1,50); %Rpass=1dB & Rstop=50dB
[B A]=butter(N,wn); % use butter to obtain an IIR filter of Butterworth type
yf=filtfilt(B,A,y);}

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!