Transforming between continuoustime and discretetime representations is useful, for example, if you have estimated a discretetime linear model and require a continuoustime model instead for your application.
You can use c2d
and d2c
to transform any linear identified
model between continuoustime and discretetime representations. d2d
is useful is you want to change the
sample time of a discretetime model. All of these operations change
the sample time, which is called resampling the
model.
These commands do not transform the estimated model uncertainty.
If you want to translate the estimated parameter covariance during
the conversion, use translatecov
.
Note:

The following table summarizes the commands for transforming between continuoustime and discretetime model representations.
Command  Description  Usage Example 

c2d  Converts continuoustime models to discretetime models. You
cannot use  To transform a continuoustime model mod_d = c2d(mod_c,T) where 
d2c  Converts parametric discretetime models to continuoustime
models. You cannot use  To transform a discretetime model mod_d to
a continuoustime form, use the following command:mod_c = d2c(mod_d) 
d2d  Resample a linear discretetime model and produce an equivalent
discretetime model with a new sample time. You can use the resampled model to simulate or predict output with a specified time interval.  To resample a discretetime model mod_d2 = d2d(mod_d1,Ts) 
The following commands compare estimated
model m
and its continuoustime counterpart mc
on
a Bode plot:
% Estimate discretetime ARMAX model % from the data m = armax(data,[2 3 1 2]); % Convert to continuoustime form mc = d2c(m); % Plot bode plot for both models bode(m,mc)
A sampled signal is characterized only by its values at the
sampling instants. However, when you apply a continuoustime input
to a continuoustime system, the output values at the sampling instants
depend on the inputs at the sampling instants and on the inputs between
these points. Thus, the InterSample
data property
describes how the algorithms should handle the input between samples.
For example, you can specify the behavior between the samples to be
piecewise constant (zeroorder hold, zoh
) or linearly
interpolated between the samples (first order hold, foh
).
The transformation formulas for c2d
and d2c
are
affected by the intersample behavior of the input.
By default, c2d
and d2c
use
the intersample behavior you assigned to the estimation data. To override
this setting during transformation, add an extra argument in the syntax.
For example:
% Set firstorder hold intersample behavior mod_d = c2d(mod_c,T,'foh')
c2d
, d2c
, and d2d
change
the sample time of both the dynamic model and the noise model. Resampling
a model affects the variance of its noise model.
A parametric noise model is a timeseries model with the following mathematical description:
$$\begin{array}{l}y(t)=H(q)e(t)\\ E{e}^{2}=\lambda \end{array}$$
The noise spectrum is computed by the following discretetime equation:
$${\Phi}_{v}(\omega )=\lambda T{\leftH\left({e}^{i\omega T}\right)\right}^{2}$$
where $$\lambda $$ is the variance of the white noise e(t), and $$\lambda T$$ represents the spectral density of e(t). Resampling the noise model preserves the spectral density $$\lambda $$T . The spectral density $$\lambda $$T is invariant up to the Nyquist frequency. For more information about spectrum normalization, see Spectrum Normalization.
d2d
resampling of the noise model affects
simulations with noise using sim
. If you resample
a model to a faster sampling rate, simulating this model results in
higher noise level. This higher noise level results from the underlying
continuoustime model being subject to continuoustime white noise
disturbances, which have infinite, instantaneous variance. In this
case, the underlying continuoustime model is
the unique representation for discretetime models. To maintain the
same level of noise after interpolating the noise signal, scale the
noise spectrum by $$\sqrt{{\scriptscriptstyle \raisebox{1ex}{${T}_{New}$}\!\left/ \!\raisebox{1ex}{${T}_{Old}$}\right.}}$$, where T_{new} is
the new sample time and T_{old} is
the original sample time. before applying sim
.