| Robust Control Toolbox | |
| Provide feedback about this page |
Time response of sampled-data feedback system
Syntax
sdlsim(p,k,w,t,tf) sdlsim(p,k,w,t,tf,x0,z0) sdlsim(p,k,w,t,tf,x0,z0,int) [vt,yt,ut,t] = sdlsim(p,k,w,t,tf) [vt,yt,ut,t] = sdlsim(p,k,w,t,tf,x0,z0,int)
Description
plots the time response of the hybrid feedback system. sdlsim(p,k,w,t,tf)
lft(p,k), is forced by the continuous input signal described by w and t (values and times, as in lsim). p must be a continuous-time LTI system, and k must be discrete-time LTI system with a specified sampling time (the unspecified sampling time -1 is not allowed). The final time is specified with tf.
specifies the initial state vector sdlsim(p,k,w,t,tf,x0,z0)
x0 of p, and z0 of k, at time t(1).
specifies the continuous-time integration step size sdlsim(p,k,w,t,tf,x0,z0,int)
int. sdlsim forces int = (k.Ts)/N int where N>4 is an integer. If any of these optional arguments is omitted, or passed as empty matrices, then default values are used. The default value for x0 and z0 is zero. Nonzero initial conditions are allowed for p (and/or k) only if p (and/or k) is an ss object.
If p and/or k is an LTI array with consistent array dimensions, then the time simulation is performed pointwise across the array dimensions.
computes the continuous-time response of the hybrid feedback system [vt,yt,ut,t] = sdlsim(p,k,w,t,tf)
lft(p,k) forced by the continuous input signal defined by w and t (values and times, as in lsim). p must be a continuous-time system, and k must be discrete-time, with a specified sampling time (the unspecified sampling time -1 is not allowed). The final time is specified with tf. The outputs vt, yt and ut are 2-by-1 cell arrays: in each the first entry is a time vector, and the second entry is the signal values. Stored in this manner, the signal vt is plotted by using one of the following commands:
Signals yt and ut are respectively the input to k and output of k.
If p and/or k are LTI arrays with consistent array dimensions, then the time simulation is performed pointwise across the array dimensions. The outputs are 2-by-1-by-array dimension cell arrays. All responses can be plotted simultaneously, for example, plot(vt).
[vt,yt,ut,t] = sdlsim(p,k,w,t,tf,x0,z0,int) The optional arguments are int (integration step size), x0 (initial condition for p), and z0 (initial condition for k). sdlsim forces int = (k.Ts)/N, where N>4 is an integer. If any of these arguments is omitted, or passed as empty matrices, then default values are used. The default value for x0 and z0 is zero. Nonzero initial conditions are allowed for p (and/or k) only if p (and/or k) is an ss object.
Example
To illustrate the use of sdlsim, consider the application of a discrete controller to an integrator with near integrator. A continuous plant and a discrete controller are created. A sample and hold equivalent of the plant is formed and the discrete closed-loop system is calculated. Simulating this with lsim gives the system response at the sample points. sdlsim is then used to calculate the intersample behavior.
P = tf(1,[1, 1e-5,0]); T = 1.0/20; C = ss([-1.5 T/4; -2/T -.5],[ .5 2;1/T 1/T],... [-1/T^2 -1.5/T], [1/T^2 0],T); Pd = c2d(P,T,'zoh');
The closed-loop digital system is now set up. You can use sysic to construct the interconnected feedback system.
systemnames = 'Pd C'; inputvar = '[ref]'; outputvar = '[Pd]'; input_to_Pd = '[C]'; input_to_C = '[ref ; Pd]'; sysoutname = 'dclp'; cleanupsysic = 'yes'; sysic;
lsim is used to simulate the digital step response.
The continuous interconnection is set up and the sampled data response is calculated with sdlsim.
M = [0,1;1,0;0,1]*blkdiag(1,P); t = [0:.01:1]'; u = ones(size(t)); y1 = sdlsim(M,C,u,t); plot(td,yd,'r*',y1{:},'b-') axis([0,1,0,1.5]) xlabel('Time: seconds') title('Step response: discrete (*), &continuous')
You can see the effect of a nonzero initial condition in the continuous-time system. Note how examining the system at only the sample points will underestimate the amplitude of the overshoot.
y2 = sdlsim(M,C,u,t,1,0,[0.25;0]); plot(td,yd,'r*',y1{:},'b-',y2{:},'g--') axis([0,1,0,1.5]) xlabel('Time: seconds') title('Step response: non zero initial condition')
Finally, you can examine the effect of a sinusoidal disturbance at the continuous-time plant output. This controller is not designed to reject such a disturbance and the system does not contain antialiasing filters. Simulating the effect of antialiasing filters is easily accomplished by including them in the continuous interconnection structure.
M2 = [0,1,1;1,0,0;0,1,1]*blkdiag(1,1,P); t = [0:.001:1]'; dist = 0.1*sin(41*t); u = ones(size(t)); [y3,meas,act] = sdlsim(M2,C,[u dist],t,1); plot(y3{:},'-',t,dist,'b--',t,u,'g-.') xlabel('Time: seconds') title('Step response: disturbance (dashed) & output (solid)')
Algorithm
sdlsim oversamples the continuous-time, N times the sample rate of the controller k.
See Also
gapmetric Computes the gap and the Vinnicombe gap metric
hinfsynSynthesizes a H
optimal controller
norm Computes the system norm of an LTI object
sdhinfnorm Calculates the norm of a sampled-data feedback
system
sdhinfsyn Synthesizes a sample-data H
optimal controller
| Provide feedback about this page |
![]() | sdhinfsyn | sectf | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |