Designing an Output Zeroing Input for an LTI Discrete-Time System in MATLAB
I am working with an LTI discrete-time system and trying to design an output zeroing input based on its invariant zeros, zero direction input, and zero direction state. My goal is to write an MATLAB script (mfile) that demonstrates how the output remains zero for all time steps when the appropriate input and initial state are applied.
Here’s what I have done so far:
I defined the system matrices A,B,C,D.
I computed the invariant zeros using the tzero function.
For one of the invariant zero, I constructed the rosenbrock matrix [zI−A,−B;C,D] and computed its null space to obtain the zero direction state and zero direction input .
I simulated the system by two approach 1-using lsim with the designed input sequence zand the initial state2- solving discrete time state space equation
However the output is not exactly zero and by changing the sampling time the response changes. It should be noted that when a smaller sampling time is chosen (e.g., Ts=0.01Ts=0.01), the output response becomes worse, whereas increasing the sampling time (e.g., Ts=0.1Ts=0.1) results in a response closer to zero. How should a correct and realistic simulation be performed especially when the system’s sampling time is fixed and cannot be changed? I would appreciate it if someone could review my code and suggest improvements or point out any mistakes.
clc
clear all
close all
%% Parameters of the Plant discrete-time model
Ac_xe=[0 1 0;0 0 1;-0.57375 -2.0775 -2.5]
Bc_a=[0;0;1]
Cc_xe=[1.1 1 0]
Dc_xe=0;
n=3; %%% states number
p=1; %% output number
m=1 %%input number
Ts=0.01; %% sampling time
td=0.01;
time=0:td:10;
plant=ss(Ac_xe,Bc_a,Cc_xe,Dc_xe,Ts);
Zcl=tzero(plant)
za=Zcl(find(abs(Zcl)>1))
P_Rosenbrock=[za*eye(n)-Ac_xe -Bc_a;Cc_xe Dc_xe]
zero_direc1=null(P_Rosenbrock)
xc(:,1)=(zero_direc1(1:n,1));
%%firstmethod
for k=1:length(time)
sig_nf(k)=(zero_direc1(n+1:n+m,1))*(za^(k-1));
xc(:,k+1)=Ac_xe*xc(:,k)+Bc_a*sig_nf(k);
end
yc=(Cc_xe*xc(:,1:length(time)))+(Dc_xe*sig_nf);
figure(1)
subplot(3,1,2)
plot(time,yc,’LineWidth’,1.5)
xlabel(‘time(second)’)
ylabel(‘y’)
second mfile with lsim
clc
clear all
close all
%% Parameters of the Plant discrete-time model
Ac_xe=[0 1 0;0 0 1;-0.57375 -2.0775 -2.5]
Bc_a=[0;0;1]
Cc_xe=[1.1 1 0]
Dc_xe=0;
n=3; %%% states number
p=1; %% output number
m=1 %%input number
Ts=0.01; %% sampling time
td=0.01;
time=0:td:10;
plant=ss(Ac_xe,Bc_a,Cc_xe,Dc_xe,Ts);
Zcl=tzero(plant)
za=Zcl(find(abs(Zcl)>1))
P_Rosenbrock=[za*eye(n)-Ac_xe -Bc_a;Cc_xe Dc_xe]
zero_direc1=null(P_Rosenbrock)
xc(:,1)=(zero_direc1(1:n,1));
for k=1:length(time)
sig_nf(k)=(zero_direc1(n+1:n+m,1))*(za^(k-1));
end
[yc,t,xc]=lsim(plant,(sig_nf)’,time,zero_direc1(1:n,1));
figure(1)
subplot(3,1,2)
plot(time,yc,’LineWidth’,1.5)
xlabel(‘time(second)’)
ylabel(‘y’)I am working with an LTI discrete-time system and trying to design an output zeroing input based on its invariant zeros, zero direction input, and zero direction state. My goal is to write an MATLAB script (mfile) that demonstrates how the output remains zero for all time steps when the appropriate input and initial state are applied.
Here’s what I have done so far:
I defined the system matrices A,B,C,D.
I computed the invariant zeros using the tzero function.
For one of the invariant zero, I constructed the rosenbrock matrix [zI−A,−B;C,D] and computed its null space to obtain the zero direction state and zero direction input .
I simulated the system by two approach 1-using lsim with the designed input sequence zand the initial state2- solving discrete time state space equation
However the output is not exactly zero and by changing the sampling time the response changes. It should be noted that when a smaller sampling time is chosen (e.g., Ts=0.01Ts=0.01), the output response becomes worse, whereas increasing the sampling time (e.g., Ts=0.1Ts=0.1) results in a response closer to zero. How should a correct and realistic simulation be performed especially when the system’s sampling time is fixed and cannot be changed? I would appreciate it if someone could review my code and suggest improvements or point out any mistakes.
clc
clear all
close all
%% Parameters of the Plant discrete-time model
Ac_xe=[0 1 0;0 0 1;-0.57375 -2.0775 -2.5]
Bc_a=[0;0;1]
Cc_xe=[1.1 1 0]
Dc_xe=0;
n=3; %%% states number
p=1; %% output number
m=1 %%input number
Ts=0.01; %% sampling time
td=0.01;
time=0:td:10;
plant=ss(Ac_xe,Bc_a,Cc_xe,Dc_xe,Ts);
Zcl=tzero(plant)
za=Zcl(find(abs(Zcl)>1))
P_Rosenbrock=[za*eye(n)-Ac_xe -Bc_a;Cc_xe Dc_xe]
zero_direc1=null(P_Rosenbrock)
xc(:,1)=(zero_direc1(1:n,1));
%%firstmethod
for k=1:length(time)
sig_nf(k)=(zero_direc1(n+1:n+m,1))*(za^(k-1));
xc(:,k+1)=Ac_xe*xc(:,k)+Bc_a*sig_nf(k);
end
yc=(Cc_xe*xc(:,1:length(time)))+(Dc_xe*sig_nf);
figure(1)
subplot(3,1,2)
plot(time,yc,’LineWidth’,1.5)
xlabel(‘time(second)’)
ylabel(‘y’)
second mfile with lsim
clc
clear all
close all
%% Parameters of the Plant discrete-time model
Ac_xe=[0 1 0;0 0 1;-0.57375 -2.0775 -2.5]
Bc_a=[0;0;1]
Cc_xe=[1.1 1 0]
Dc_xe=0;
n=3; %%% states number
p=1; %% output number
m=1 %%input number
Ts=0.01; %% sampling time
td=0.01;
time=0:td:10;
plant=ss(Ac_xe,Bc_a,Cc_xe,Dc_xe,Ts);
Zcl=tzero(plant)
za=Zcl(find(abs(Zcl)>1))
P_Rosenbrock=[za*eye(n)-Ac_xe -Bc_a;Cc_xe Dc_xe]
zero_direc1=null(P_Rosenbrock)
xc(:,1)=(zero_direc1(1:n,1));
for k=1:length(time)
sig_nf(k)=(zero_direc1(n+1:n+m,1))*(za^(k-1));
end
[yc,t,xc]=lsim(plant,(sig_nf)’,time,zero_direc1(1:n,1));
figure(1)
subplot(3,1,2)
plot(time,yc,’LineWidth’,1.5)
xlabel(‘time(second)’)
ylabel(‘y’) I am working with an LTI discrete-time system and trying to design an output zeroing input based on its invariant zeros, zero direction input, and zero direction state. My goal is to write an MATLAB script (mfile) that demonstrates how the output remains zero for all time steps when the appropriate input and initial state are applied.
Here’s what I have done so far:
I defined the system matrices A,B,C,D.
I computed the invariant zeros using the tzero function.
For one of the invariant zero, I constructed the rosenbrock matrix [zI−A,−B;C,D] and computed its null space to obtain the zero direction state and zero direction input .
I simulated the system by two approach 1-using lsim with the designed input sequence zand the initial state2- solving discrete time state space equation
However the output is not exactly zero and by changing the sampling time the response changes. It should be noted that when a smaller sampling time is chosen (e.g., Ts=0.01Ts=0.01), the output response becomes worse, whereas increasing the sampling time (e.g., Ts=0.1Ts=0.1) results in a response closer to zero. How should a correct and realistic simulation be performed especially when the system’s sampling time is fixed and cannot be changed? I would appreciate it if someone could review my code and suggest improvements or point out any mistakes.
clc
clear all
close all
%% Parameters of the Plant discrete-time model
Ac_xe=[0 1 0;0 0 1;-0.57375 -2.0775 -2.5]
Bc_a=[0;0;1]
Cc_xe=[1.1 1 0]
Dc_xe=0;
n=3; %%% states number
p=1; %% output number
m=1 %%input number
Ts=0.01; %% sampling time
td=0.01;
time=0:td:10;
plant=ss(Ac_xe,Bc_a,Cc_xe,Dc_xe,Ts);
Zcl=tzero(plant)
za=Zcl(find(abs(Zcl)>1))
P_Rosenbrock=[za*eye(n)-Ac_xe -Bc_a;Cc_xe Dc_xe]
zero_direc1=null(P_Rosenbrock)
xc(:,1)=(zero_direc1(1:n,1));
%%firstmethod
for k=1:length(time)
sig_nf(k)=(zero_direc1(n+1:n+m,1))*(za^(k-1));
xc(:,k+1)=Ac_xe*xc(:,k)+Bc_a*sig_nf(k);
end
yc=(Cc_xe*xc(:,1:length(time)))+(Dc_xe*sig_nf);
figure(1)
subplot(3,1,2)
plot(time,yc,’LineWidth’,1.5)
xlabel(‘time(second)’)
ylabel(‘y’)
second mfile with lsim
clc
clear all
close all
%% Parameters of the Plant discrete-time model
Ac_xe=[0 1 0;0 0 1;-0.57375 -2.0775 -2.5]
Bc_a=[0;0;1]
Cc_xe=[1.1 1 0]
Dc_xe=0;
n=3; %%% states number
p=1; %% output number
m=1 %%input number
Ts=0.01; %% sampling time
td=0.01;
time=0:td:10;
plant=ss(Ac_xe,Bc_a,Cc_xe,Dc_xe,Ts);
Zcl=tzero(plant)
za=Zcl(find(abs(Zcl)>1))
P_Rosenbrock=[za*eye(n)-Ac_xe -Bc_a;Cc_xe Dc_xe]
zero_direc1=null(P_Rosenbrock)
xc(:,1)=(zero_direc1(1:n,1));
for k=1:length(time)
sig_nf(k)=(zero_direc1(n+1:n+m,1))*(za^(k-1));
end
[yc,t,xc]=lsim(plant,(sig_nf)’,time,zero_direc1(1:n,1));
figure(1)
subplot(3,1,2)
plot(time,yc,’LineWidth’,1.5)
xlabel(‘time(second)’)
ylabel(‘y’) lti systems, invariant zeros, output zeroing, matlab, discrete-time lit systems MATLAB Answers — New Questions