Main Content

wnoise

Noisy wavelet test data

Description

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

example

[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);
tiledlayout(2,1)
nexttile
plot(loc,x)
title('Clean Doppler')
ylim([-15 15])
nexttile
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'};
tiledlayout(3,2)
for i=1:6
    x = wnoise(lower(testFunctions{i}),10);
    nexttile
    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, David L, and Iain M Johnstone. “Ideal Spatial Adaptation by Wavelet Shrinkage.” Biometrika 81, no. 3 (September 1, 1994): 425–55. https://doi.org/10.1093/biomet/81.3.425.

[2] Donoho, David L., and Iain M. Johnstone. “Adapting to Unknown Smoothness via Wavelet Shrinkage.” Journal of the American Statistical Association 90, no. 432 (December 1995): 1200–1224. https://doi.org/10.1080/01621459.1995.10476626.

Version History

Introduced before R2006a

See Also

|