Consider the 256 times 256 image Building to answer this pro

Consider the 256 times 256 image, Building, to answer this problem, It is available as a. Ti f file along with this homework at the Blackboard site. Let x (n_1, n_2) denote this image. Compute the 2-D DCT of the Image x(n_1, n_2). Retain the 8192 largest (magnitude-wide) elements of this transform and set all other elements to zero. Determine the reconstructed image c (n_1, n_2). Compute the Signal to Noise Ratio (SNR) of the reconstructed image as SNR = 10 log_10 [sigma^N-1_n_1 = 0sigma^N-1_n_2 = 0 x^2 (n_1, n_2)/sigma^N-1_n_1 = 0 sigma^N-1/n_2 = 0 {x(n_1, n_2) - x (n_1, n_2)}]^2 Visually compare the original image x (n_1, n_2) and its reconstruction x (n_1, n_2).

Solution

matlab program to signal to noise ratio

r = snr(x,y)
r = snr(x)
r = snr(x,fs,n)
r = snr(pxx,f,\'psd\')
r = snr(pxx,f,n,\'psd\')
r = snr(sxx,f,rbw,\'power\')
r = snr(sxx,f,rbw,n,\'power\')
r = snr(___,\'aliased\')
[r,noisepow] = snr(___)
snr(___)
Description
r = snr(x,y) returns the signal-to-noise ratio (SNR) in decibels of a signal, x, by computing the ratio of its summed squared magnitude to that of the noise, y. y must have the same dimensions as x. Use this form when the input signal is not necessarily sinusoidal and you have an estimate of the noise.
r = snr(x) returns the SNR in decibels relative to the carrier (dBc) of a real-valued sinusoidal input signal, x. The SNR is determined using a modified periodogram of the same length as the input. The modified periodogram uses a Kaiser window with = 38. The result excludes the power of the first six harmonics, including the fundamental.
r = snr(x,fs,n) returns the SNR in dBc of a real sinusoidal input signal, x, sampled at a rate fs. The computation excludes the power contained in the lowest n harmonics, including the fundamental. The default value of fs is 1. The default value of n is 6.
r = snr(pxx,f,\'psd\') specifies the input pxx as a one-sided power spectral density (PSD) estimate. The argument f is a vector of the frequencies at which the estimates of pxx occur. The computation of noise excludes the power of the first six harmonics, including the fundamental.
r = snr(pxx,f,n,\'psd\') specifies the number of harmonics, n, to exclude when computing the SNR. The default value of n is 6 and includes the fundamental.
r = snr(sxx,f,rbw,\'power\') specifies the input as a one-sided power spectrum, sxx, of a real signal. The input rbw is the resolution bandwidth over which each power estimate is integrated.
r = snr(sxx,f,rbw,n,\'power\') specifies the number of harmonics, n, to exclude when computing the SNR. The default value of n is 6 and includes the fundamental.
r = snr(___,\'aliased\') removes harmonics of the fundamental that are aliased into the Nyquist range. Use this option when the input signal is undersampled. If you do not specify this option, or if you set it to \'omitaliases\', then the function treats as noise any harmonics of the fundamental frequency that lie beyond the Nyquist range.
[r,noisepow] = snr(___) also returns the total noise power of the nonharmonic components of the signal.
snr(___) with no output arguments plots the spectrum of the signal in the current figure window and labels its main features. It uses different colors to draw the fundamental component, the DC value and the harmonics, and the noise. The SNR appears above the plot. This functionality works for all syntaxes listed above except snr(x,y).
collapse all
Signal-to-Noise Ratio for Rectangular Pulse with Gaussian Noise
Open Script
Compute the signal-to-noise ratio (SNR) of a 20 ms rectangular pulse sampled for 2 s at 10 kHz in the presence of Gaussian noise. Set the random number generator to the default settings for reproducible results.
rng default
Tpulse = 20e-3;
Fs = 10e3;
t = -1:1/Fs:1;
x = rectpuls(t,Tpulse);
y = 0.00001*randn(size(x));
s = x + y;
pulseSNR = snr(x,s-x)
pulseSNR =

80.0818

Compare SNR with THD and SINAD
Open Script
Compute and compare the signal-to-noise ratio (SNR), the total harmonic distortion (THD), and the signal to noise and distortion ratio (SINAD) of a signal.

Create a sinusoidal signal sampled at 48 kHz. The signal has a fundamental of frequency 1 kHz and unit amplitude. It additionally contains a 2 kHz harmonic with half the amplitude and additive noise with variance 0.12.

fs = 48e3;
t = 0:1/fs:1-1/fs;
A = 1.0;
powfund = A^2/2;
a = 0.4;
powharm = a^2/2;
s = 0.1;
varnoise = s^2;
x = A*cos(2*pi*1000*t) + ...
a*sin(2*pi*2000*t) + s*randn(size(t));
Verify that SNR, THD, and SINAD agree with their definitions.

SNR = snr(x);
defSNR = 10*log10(powfund/varnoise);
SN = [SNR defSNR]

THD = thd(x);
defTHD = 10*log10(powharm/powfund);
TH = [THD defTHD]

SINAD = sinad(x);
defSINAD = 10*log10(powfund/(powharm+varnoise));
SI = [SINAD defSINAD]
SN =

17.0178 16.9897


TH =

-7.9546 -7.9588


SI =

7.4571 7.4473

Signal-to-Noise Ratio of Sinusoid
Open Script
Compute the SNR of a 2.5 kHz sinusoid sampled at 48 kHz. Add white noise with variance 0.0012.

Fi = 2500;
Fs = 48e3;
N = 1024;
x = sin(2*pi*Fi/Fs*(1:N)) + 0.001*randn(1,N);
SNR = snr(x,Fs)
SNR =

57.7103

 Consider the 256 times 256 image, Building, to answer this problem, It is available as a. Ti f file along with this homework at the Blackboard site. Let x (n_1
 Consider the 256 times 256 image, Building, to answer this problem, It is available as a. Ti f file along with this homework at the Blackboard site. Let x (n_1

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site