Code covered by the BSD License

# "COMM" : Commande et Observation Mono- et Multivariables

### Eric Ostertag (view profile)

27 Jun 2005 (Updated )

Companion software to french book "Commande et estimation multivariables"

responses.m
```% Responses :
%  Script de trac de diverses rponses libres ou indicielles, d'tats rels
%  et/ou estims, de sorties et de commandes.
%
%  Auteur : E. Ostertag  27 juin 2005
%
%	 Mise  jour : 28 fvrier 2006

n=size(A_BF,1); p = size(B,2); q =size(Cm,1);
%
% Trac des rponses indicielles du systme boucl
%
rep = input('Rponses indicielles du systme boucl,  x0 = 0 (O/N) ? [N] --> ','s');
if isempty(rep)
rep = 'N';
else
rep = rep(1);
end
if rep == 'O' || rep == 'o',
for i=1:p;
sys_BFy{i} = ss(A_BF,B_BF(:,i),C_BF,D_BF(:,i),T);
yc_sim = ones(length(t),1);
y12 = lsim(sys_BFy{i},yc_sim*yc(i),t);
for j=1:q,
figure; plot(t,y12(:,j)); grid on;
xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
title(['Rponse indicielle : de yc' num2str(i) ' vers y' num2str(j)],'FontName','Times New Roman','FontSize',14.0);
end
end
end
%
% Trac des rponses libres de la boucle ouverte
%
if integ == 1;
rep = 'N';
else
rep = input('Rponses libres de la boucle ouverte (u = 0 et x0 non nul) (O/N) ? [N] --> ','s');
if isempty(rep)
rep = 'N';
else
rep = rep(1);
end
end
if rep == 'O' || rep == 'o',
figure;
sys_BO = ss(A,B,Cm,D,T);
[Y,t,x] = initial(sys_BO,xx0,t);
for j=1:q,
subplot(q,1,j); plot(t,Y(:,j)); grid on;
if j == 1,
title('Rponse libre du systme ouvert','FontName','Times New Roman','FontSize',14.0);
end
ylabel(['vers : y(' num2str(j,1) ')'],'FontName','Times New Roman','FontSize',14.0);
end
xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
end
%
% Trac des rponses libres du systme boucl
%
rep = input('Rponses libres du systme boucl (yc = 0 et x0 non nul) (O/N) ? [N] --> ','s');
if isempty(rep)
rep = 'N';
else
rep = rep(1);
end
if rep == 'O' || rep == 'o',
figure;
[Y,t,x] = initial(sys_BF,[xx0 zeros(1,qi)],t);
for j = 1:q,
subplot(q,1,j); plot(t,Y(:,j)); grid on;
if j == 1,
title('Rponse libre du systme boucl','FontName','Times New Roman','FontSize',14.0);
end
ylabel(['vers : y(' num2str(j,1) ')'],'FontName','Times New Roman','FontSize',14.0);
end
xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
end
%
% Trac des commandes du systme boucl, en rponse libre  partir de x0
%
rep = input('Commandes du systme boucl (rponse libre  partir de x0) (O/N) ? [N] --> ','s');
if isempty(rep)
rep = 'N';
else
rep = rep(1);
end
if rep == 'O' || rep == 'o',
figure
sys_BF_u = ss(A_BF,B_BF,-L,zeros(p,p),T);
[Y,t,x] = initial(sys_BF_u,[xx0 zeros(1,qi)],t);
for j = 1:p,
subplot(p,1,j); plot(t,Y(:,j)); grid on;
if j == 1,
title('Commandes du systme boucl (en rponse libre)','FontName','Times New Roman','FontSize',14.0);
end
ylabel(['u(' num2str(j,1) ')'],'FontName','Times New Roman','FontSize',14.0);
end
xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
end
```