INDEX

Function: PLOT_RES


Purpose. Computes and plots (bar diagrams) residuals.

Synopsis.

[pol,res] = plot_res(sys,iu,iy[,time[,npol[,fsize[,color]]]])

Description. The residuals are considered between the iuth input(s) and the iyth output(s) (note that iu and iy can be vectors). If the input argument time is equal to 0, standard residuals are considered. If time > 0, residuals are replaced by the unit step response value at the given time (which can be time = inf). Note that iu and iy can be vectors. For computing the global residuals of a system with m inputs and p outputs set iu = [1:m] and iy = [1:p]. (Note that in order to use this function for sub-plots the figure is not initialized.) If this function is invoked with output arguments, the bars are not plotted.

Input arguments

 sys LTI system (see ss.m).
 iu,iy Indices of input(s) and output(s) for residual computation.
 npol Number of the most significant poles to be considered.
 time Scalar number. time = 0 for true residuals (impulse response), time = inf for residuals related to step response, time > 0 for intermediate values of the step response.
 fsize Size of the fonts, default fsize = 10.
 color String like 'g-' for green solid line....

Output arguments

 pol Vector of the npol poles with largest residuals (in decreasing order of magnitude).
 res Values of the residuals.

See also: lsim_mod, plot_con


Example. Comparison of information obtained by using lsim_mod and plot_res. Computation of the true residuals (the 8 most significant ones) and comparison to impulse response obtained by modal simulation.
  randn('seed',0); rand('seed',0);
  sys = rss(20,3,3);

  figure
  plot_res(sys,2,3,0,8);

The true residuals are given in the following figure

Modal simulation

  u = zeros(100,3);
  t = 0.01*[0:1:99]';
  x0 = zeros(20,1);
  u(1,2)=100;
  lsim_mod(sys,u,t,x0,'y3',8,[1,2,1],[1,2,2]);
The magnitude of the bars corresponds to initial values of modal simulations. Note that the measure of pole ``dominance'' is not exactly the same using plot_res and lsim_mod which explains the different ordering in both figures.

Now, let us consider a similar comparison concerning steady state values of a step response.

  figure
  plot_res(sys,2,3,inf,8);

  lsim_mod(sys,'u2',60,0,'y3',8,[1,2,1],[1,2,2]);
The bars (not plotted here) correspond to the final values of the simulation.