Use the noisepsdopts function to set options to compute the output noise PSD. filt1 and filt2 are lowpass filters that use different design methods. The opts object makes it easier to set the same conditions for the noise PSD computation in the noisepsd function.
d = fdesign.lowpass
d =
lowpass with properties:
Response: 'Lowpass'
Specification: 'Fp,Fst,Ap,Ast'
Description: {4x1 cell}
NormalizedFrequency: 1
Fpass: 0.4500
Fstop: 0.5500
Apass: 1
Astop: 60
filt1 = design(d,'butter','Systemobject',true)
filt1 =
dsp.BiquadFilter with properties:
Structure: 'Direct form II'
SOSMatrixSource: 'Property'
SOSMatrix: [13x6 double]
ScaleValues: [14x1 double]
InitialConditions: 0
OptimizeUnityScaleValues: true
Show all properties
filt2 = design(d,'cheby2','Systemobject',true)
filt2 =
dsp.BiquadFilter with properties:
Structure: 'Direct form II'
SOSMatrixSource: 'Property'
SOSMatrix: [5x6 double]
ScaleValues: [6x1 double]
InitialConditions: 0
OptimizeUnityScaleValues: true
Show all properties
opts = noisepsdopts(filt1)
opts =
struct with fields:
FreqPoints: 'All'
NFFT: 512
NormalizedFrequency: true
Fs: 'Normalized'
SpectrumType: 'Onesided'
CenterDC: false
ConfLevel: 'Not Specified'
ConfInterval: []
opts.NFFT = 256; % Same as set(opts,'nfft',256).
opts.NormalizedFrequency = false;
opts.Fs = 1.5e3;
opts.CenterDC = true
opts =
struct with fields:
FreqPoints: 'All'
NFFT: 256
NormalizedFrequency: false
Fs: 1500
SpectrumType: 'Twosided'
CenterDC: true
ConfLevel: 'Not Specified'
ConfInterval: []
With opts configured as needed, use it as an input argument for the noisepsd function.
noisepsd(filt1,20,opts)
noisepsd(filt2,20,opts)