Question: The file signal_noise.mat contains a variable x that consists of a 1.0
ID: 2248246 • Letter: Q
Question
Question: The file signal_noise.mat contains a variable x that consists of a 1.0-V peak sinusoidal signal buried in noise. What is the SNR for this signal and noise? Assume that the noise RMS is much greater than the signal RMS.
Here's the code I've written so far:
clear,clc
load('signal_noise.mat')
t=1:length(x); % create time vector
c=x.^2 ;
d=mean(c);
rms=sqrt(d); % calculate rms
snr=20*log10(rms); % calculate snr assuming signal is much less than noise
disp('The SNR is:')
disp(snr)
The end result is ~40, which can't be right considering that the noise>>>>signal. I'm stuck on how to get on the right track.
I've put the numbers from the signal_noise.mat file into a pastebin so that it's easily transposable into MATLAB, so just simply copy and paste the data into an array ( data=[ctrl+v] ).
https://pastebin.com/gdW1eLGh
Thanks in advance for any help!
Explanation / Answer
The SNR value that you have calculated using snr=20*log10(rms); does not give you the actual SNR od the signal.
This instead gives you the RMS value of (signa+noise).
If you want to get the SNR (signal to noise ratio in dB) use the following formula
SNR in dB = 20 log10 ( RMS(x) / RMS(n) );
In matlab use the following command
x_snr_db = 20 * log10 ( RMSx / RMSn ); Where the RMSx is the root mean square value of signal x and RMSn is the root mean square value of noise n.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.