Magnitude of a FIR or IIR filter.

Namespace: dsp::filter

Prototype

static tuple<Vecf, Vecf> frmag(const Design &d, unsigned int npts=1024)

Parameters

dTransfert function to be analyzed.
nptsFrequency resolution.

Returns

A tuple of 2 vectors: the frequencies \(f_k\) (normalized, between 0 and 0.5), and the magnitudes \(y_k\).

Description

This fonction computes the magnitude (e.g., the absolute value) of the frequency response for a linear filter: \[ y_k = \left|H(f_k)\right| \]

Example

  // Exponential filter (order 1 IIR)
  let h = design_ema(Frequency(0.25));
  let [fr, mag] = frmag(h);
  // mag(i) est le délais pour la fréquence fr(i)
  Figure f;
  f.plot(fr, mag, "b-", "Magnitude");

See also

repfreq(), frgroup(), frphase()