Main Content

normalizefreq

Switch filter specification between normalized frequency and absolute frequency

Syntax

normalizefreq(d)
normalizefreq(d,flag)
normalizefreq(d,false,fs)

Description

normalizefreq(d) normalizes the frequency specifications in filter specifications object d. By default, the NormalizedFrequency property is set to true when you create a design object. You provide the design specifications in normalized frequency units. normalizefreq does not affect filters that already use normalized frequency.

If you use this syntax when d does not use normalized frequency specifications, all of the frequency specifications are normalized by fs/2 so they lie between 0 and 1, where fs is specified in the object. Included in the normalization are the filter properties that define the filter pass and stopband edge locations by frequency:

  • F3 dB — Used by IIR filter specifications objects to describe the passband cutoff frequency

  • Fcutoff — Used by FIR filter specifications objects to describe the passband cutoff frequency

  • Fpass — Describes the passband edges

  • Fstop — Describes the stopband edges

In this syntax, normalizefreq(d) assumes you specified fs when you created d or changed d to use absolute frequency specifications.

normalizefreq(d,flag) where flag is either true or false, specifies whether the NormalizedFrequency property value is true or false and therefore whether the filter normalizes the sampling frequency fs and other related frequency specifications. fs defaults to 1 for this syntax.

When you do not provide the input argument flag, it defaults to true. If you set flag to false, affected frequency specifications are multiplied by fs/2 to remove the normalization. Use this syntax to switch your filter between using normalized frequency specifications and not using normalized frequency specifications.

normalizefreq(d,false,fs) lets you specify a new sampling frequency fs when you set the NormalizedFrequency property to false.

Examples

collapse all

These examples demonstrate using normalizefreq in both of the major syntax applications-setting the design object frequency specifications to use absolute frequency (normalizefreq(hd,false,fs)) and resetting a design object to using normalized frequencies (normalizefreq(d)).

Construct a highpass filter specifications object by specifying the passband and stopband edges and the desired attenuations in the bands. By default, provide the frequency specifications in normalized values between 0 and 1.

d = fdesign.highpass(0.35, 0.45, 60, 40);

Fstop and Fpass are in normalized form, and the property NormalizedFrequency is true.

Now use normalizedfreq to convert to absolute frequency specifications, with a sampling frequency of 1000 Hz.

normalizefreq(d,false,1e3);

Both of the attenuation specifications remain the same. The passband and stopband edge definitions now appear in Hz, where the new value represents the normalized values multiplied by Fs/2, or 500 Hz.

Converting to using normalized frequencies consists of using normalizefreq with the design object d.

normalizefreq(d)

For bandstop, bandpass, and multiple band filter specifications objects, normalizefreq works the same way for all band edge definitions. When you do not provide the sampling frequency Fs as an input argument and you are converting to absolute frequency specifications, normalizefreq sets Fs to 1, as shown in this example.

d=fdesign.bandstop(0.25,0.35,0.55,0.65,50,60);
normalizefreq(d,false)

Version History

Introduced in R2011a