|On this page…|
Transforming between continuous-time and discrete-time representations is useful, for example, if you have estimated a discrete-time linear model and require a continuous-time model instead for your application.
You can use c2d and d2c to transform any linear identified model between continuous-time and discrete-time representations. d2d is useful is you want to change the sampling interval of a discrete-time model. All of these operations change the sampling interval, 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.
The following table summarizes the commands for transforming between continuous-time and discrete-time model representations.
|c2d||Converts continuous-time models to discrete-time models.|
You cannot use c2d for idproc models and for idgrey models whose FcnType is not 'cd'. Convert these models into idpoly, idtf, or idss models before calling c2d.
To transform a continuous-time model mod_c to a discrete-time form, use the following command:
mod_d = c2d(mod_c,T)
where T is the sampling interval of the discrete-time model.
|d2c||Converts parametric discrete-time models to continuous-time
You cannot use d2c for idgrey models whose FcnType is not 'cd'. Convert these models into idpoly, idtf, or idss models before calling d2c.
|To transform a discrete-time model mod_d to
a continuous-time form, use the following command:|
mod_c = d2c(mod_d)
|d2d||Resample a linear discrete-time model and produce an equivalent
discrete-time model with a new sampling interval.|
You can use the resampled model to simulate or predict output with a specified time interval.
To resample a discrete-time model mod_d1 to a discrete-time form with a new sampling interval Ts, use the following command:
mod_d2 = d2d(mod_d1,Ts)
The following commands compare estimated model m and its continuous-time counterpart mc on a Bode plot:
% Estimate discrete-time ARMAX model % from the data m = armax(data,[2 3 1 2]); % Convert to continuous-time 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 continuous-time input to a continuous-time 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 piece-wise constant (zero-order 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 first-order hold intersample behavior mod_d = c2d(mod_c,T,'foh')
c2d, d2c, and d2d change the sampling interval 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 time-series model with the following mathematical description:
The noise spectrum is computed by the following discrete-time equation:
where is the variance of the white noise e(t), and represents the spectral density of e(t). Resampling the noise model preserves the spectral density T . The spectral density 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 continuous-time model being subject to continuous-time white noise disturbances, which have infinite, instantaneous variance. In this case, the underlying continuous-time model is the unique representation for discrete-time models. To maintain the same level of noise after interpolating the noise signal, scale the noise spectrum by , where Tnew is the new sampling interval and Told is the original sampling interval. before applying sim.