Main Content

wnoise

Noisy wavelet test data

Description

example

x = wnoise(fun,n) returns values x of the test signal fun evaluated at 2n linearly spaced points from 0 to 1.

[x,xn] = wnoise(fun,n,sqrtsnr) returns x rescaled such that the standard deviation of x is sqrtsnr. xn is x corrupted by additive Gaussian white noise N(0,1) and has a signal-to-noise ratio (SNR) of sqrtsnr2.

[x,xn] = wnoise(___,init) sets the generator seed to init before generating additive Gaussian white noise N(0,1) .

Examples

collapse all

There are six test signals. Generate and plot 210 samples of the third test signal, heavy sine.

loc = linspace(0,1,2^10);
x = wnoise(3,10);
plot(loc,x)
title('Heavy Sine')

Figure contains an axes object. The axes object with title Heavy Sine contains an object of type line.

Generate and plot 210 samples of the doppler test signal and a noisy version of doppler with a square root of the signal-to-noise ratio equal to 7.

[x,noisyx] = wnoise('doppler',10,7);
subplot(2,1,1)
plot(loc,x)
title('Clean Doppler')
ylim([-15 15])
subplot(2,1,2)
plot(loc,noisyx)
title('Noisy Doppler')
ylim([-15 15])

Figure contains 2 axes objects. Axes object 1 with title Clean Doppler contains an object of type line. Axes object 2 with title Noisy Doppler contains an object of type line.

Plot all the test functions.

testFunctions = {'Blocks','Bumps','Heavy Sine','Doppler','Quadchirp','Mishmash'};
for i=1:6
    x = wnoise(lower(testFunctions{i}),10);
    subplot(3,2,i)
    plot(loc,x)
    title(testFunctions{i})
end

Figure contains 6 axes objects. Axes object 1 with title Blocks contains an object of type line. Axes object 2 with title Bumps contains an object of type line. Axes object 3 with title Heavy Sine contains an object of type line. Axes object 4 with title Doppler contains an object of type line. Axes object 5 with title Quadchirp contains an object of type line. Axes object 6 with title Mishmash contains an object of type line.

Input Arguments

collapse all

Wavelet test function, specified as one of the values listed here. The six test functions are due to Donoho and Johnstone [1], [2].

  • 1 or 'blocks'

  • 2 or 'bumps'

  • 3 or 'heavy sine'

  • 4 or 'doppler'

  • 5 or 'quadchirp'

  • 6 or 'mishmash'

Exponent used to determine the number of linearly spaced points from 0 to 1 to evaluate the test function, specified as a positive integer. The number of linearly spaced points is 2n.

Square root of SNR, specified by a positive real number. The test values x are rescaled such that the standard deviation of x is sqrtsnr. xn is equal to x corrupted by additive Gaussian white noise N(0,1) and has an SNR of sqrtsnr2.

Seed used to initialize the random number generator, specified as a nonnegative integer. init is used to generate additive Gaussian white noise.

Example: [a,b] = wnoise(4,10,7,2055415866); returns a noisy version of the fourth test signal using the seed init = 2055415866.

Output Arguments

collapse all

Test signal, returned as a real-valued vector of length 2n. x are the values of the test function specified by fun evaluated at the 2n evenly spaced points from 0 to 1. If sqrtsnr is set, the standard deviation of x is sqrtsnr.

Noisy test signal, returned as a real-valued vector of length 2n. xn is x corrupted by additive Gaussian white noise N(0,1) and has an SNR of sqrtsnr2.

References

[1] Donoho, D. L., and I. M. Johnstone. “Ideal spatial adaptation by wavelet shrinkage.” Biometrika. Vol. 81, Issue 3, 1994, pp. 425–455.

[2] Donoho, D. L., and I. M. Johnstone. “Adapting to unknown smoothness via wavelet shrinkage.” Journal of the American Statistical Association. Vol. 90, 1995, pp. 1200–1224.

See Also

|

Introduced before R2006a