noisepsd - Power spectral density of filter output

Syntax

hpsd = noisepsd(hd,l)
hpsd = noisepsd(hd,l,p1,v1,p2,v2,...)
noisepsd(hd,l,opts)

Description

hpsd = noisepsd(hd,l) computes the power spectral density (PSD) at the output of filter hd due to roundoff noise produced by quantization errors within the filter. l is the number of trials used to compute the average. The PSD is computed from the average over the l trials. The more trials you specify, the better the estimate, but at the expense of longer computation time. When you do not explicitly set l, it defaults to 10 trials.

hpsd is a psd data object. To extract the PSD vector (the data from the PSD) from hpsd, enter

get(hpsd,'data')

at the prompt. Plot the PSD data with plot(hpsd). The average power of the output noise (the integral of the PSD) can be computed with avgpower, a method of dspdata objects:

avgpwr = avgpower(hpsd).

hpsd = noisepsd(hd,l,p1,v1,p2,v2,...) specifies optional parameters via propertyname/propertyvalue pairs. The properties of the psd object, and the valid entries are:

Property Name

Default Value

Description and Valid Entries

Nfft

512

Specifies the number of FFT points to use to calculate the PSD.

NormalizedFrequency

true

Determines whether to use normalized frequency. Enter one of the logical true or false. Note that you do not use single quotations around this property value because it is a logical, not a string.

Fs

normalized

Specifies the sampling frequency to use when you set NormalizedFrequency to false. Any integer value greater than 1 works. Enter the value in Hz.

SpectrumType

onesided

Tells noisepsd whether to generate a one-sided PSD or two-sided. Options are onesided or twosided. If you choose a two-sided computation, you can also choose centerdc = true. Otherwise, centerdc must be false.

  • onesided converts the spectrum to a spectrum calculated over half the Nyquist interval. All properties affected by the new frequency range are adjusted automatically.

  • twosided converts the spectrum to a spectrum calculated over the whole Nyquist interval. All properties affected by the new frequency range are adjusted automatically.

CenterDC

false

Shifts the zero-frequency component to the center of a two-sided spectrum.

  • When you set SpectrumType to onesided, it is changed to twosided and the data is converted to a two-sided spectrum.

  • Setting CenterDC to false shifts the data and the frequency values in the object so that DC is in the left edge of the spectrum. This operation does not effect the SpectrumType property setting.

noisepsd(hd,l,opts) uses an options object opts to specify the optional input arguments instead of specifying property-value pairs in the command. Use opts = noisepsdopts(hd) to create the object. opts then has the noisepsd settings from hd. After creating opts, you change the property values before calling noisepsd:

set(opts,'fs',48e3); % Set Fs to 48 kHz.

Examples

Compute the PSD of the output noise caused by the quantization processes in a fixed-point, direct form FIR filter.

b = firgr(27,[0 .4 .6 1],[1 1 0 0]);
h = dfilt.dffir(b); % Create the filter object.
% Quantize the filter to fixed-point.
h.arithmetic = 'fixed'; 
hpsd = noisepsd(h);
plot(hpsd)

hpsd looks similar to the following figure—the data resulting from the noise PSD calculation. You can review the data in hpsd.data'.

Here is the specification for hpsd.

hpsd =
 
                   Name: 'Power Spectral Density'
                   Data: [257x1 double]
           SpectrumType: 'Onesided'
            Frequencies: [257x1 double]
    NormalizedFrequency: true
                     Fs: 'Normalized'

See Also

filter, noisepsdopts, norm, reorder, scale

spectrum.welch in Signal Processing Toolbox documentation

References

McClellan, et al., Computer-Based Exercises for Signal Processing Using MATLAB 5, Prentice-Hall, 1998.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS