Contents Previous Next Subchapters Current Chapters-> fourier kalman_bucy filter mlmode_filter arcov fspec dpss wavelet iwavelet fnbut fncheb fnbpole fncpole fn2cbp fn2clp fc2dig fn2dbp fn2dlp Parent Chapters-> Omatrix6 filtering fc2dig Search Tools-> contents reference index search

Converting From A Continuous To Digital Filter
 Syntax `fc2dig(`dt`, `numin`, `denin`, `numout`, `denout`)` See Also fdplot , fn2clp , fn2cbp , fn2dlp

Description
Converts a continuous filter to a digital filter, where dt is a real or double-precision scalar specifying the time between samples, numin is a column vector (with the same type as dt) specifying the numerator polynomial of the continuous filter, denin is a column vector (with the same type as dt) specifying the denominator polynomial for the continuous filter. The input values numout and denout have no effect. The output value of numout is the column vector that represents the numerator polynomial for the digital filter. The output value of denout is the column vector that represents the denominator polynomial for the digital filter. The output values of numout and denout have the same type as dt. ``` ```The transfer function for the continuous filter is `numin[s] / denin[s]`. The transfer function for the digital filter is ```      numout[z]     numin[(2 / dt) (z - 1) / (z + 1)]      ---------  =  ---------------------------------      denout[z]     denin[(2 / dt) (z - 1) / (z + 1)] ```
Example
The following program converts a normalized 2 pole Butterworth filter to a digital filter where the time between samples is 1. The cutoff frequency for the continuous filter is transformed to the corresponding digital cutoff frequency and included in the plot. ``` clear # numcon = 1.  dencon = {1., sqrt(2.), 1.} dt     = 1. numdig = novalue dendig = novalue fc2dig(dt, numcon, dencon, numdig, dendig) # cutoff = 1. cutoff = (2. / dt) * atan(cutoff * dt / 2) # ymin = 1e-4  ymax = 10  fdplot(dt, ymin, ymax, cutoff, numdig, dendig) ```