Inconsistent result: Integration of step response vs direct evaluation
Show older comments
I am following a work from MIT on state space -: step response. I will present 2 pages of the text and then the example problem.


Now, the example problem:::

My question and problem next:
I have done equation (vi) using a for loop below and the result is correct as the text, see below:
tt=0:1e-3:2;
for q=1:length(tt)
t=tt(q);
pp(q,:)= 5.0 + exp(-2.5*t)*(-5*cos(1.323*t) + 20.8*sin(1.323*t));
end
plot(tt,pp)

However, when I tried to integrate the actual equation in eqn(84), problem happens. I think it is because the A matrix in eqn 84 has no eigen values like eqn vi. So, I have used the eigen matrix (2x2) used in eqn(v) in the last image as a replacement. However, it is not right. Anyone knows how the actual interation would work can help,,,, thank you My code below. It shows an error due to a 2x2 from exp(-ii*t) in the ode function.Thank you very much in advance
clear all; close all; clc
global ii A B K
% % % cam = [-0.3125-0.1654*j -0.3125+0.1654*j];
% % % mbk = [-20 + 22.678*j; -20 - 22.678*j];
% % % cabk = [-5.0];
ii = [-2.5+1.3223*j 0; 0 -2.5-1.3223*j];
A = [-1 1; -4 -4];
B = [0; 4];
K = 10;
dt = .0002; %Defining Time Step:
t = 0:dt:2;% Defining time vector.
y0 = [0; 0]; %initial vel and disp [vel disp] %velocity.
[tsol, yvectorl] = ode45(@testode1,t,y0);
yvectorl = exp(-ii*0)*yvectorl*B*K;
%%plot
figure()
plot(tsol,yvectorl(:,2)), title("Displacement") %Disp.(2)
figure()
plot(tsol,yvectorl(:,1)), title("Velocity") %Vel. (1
function dy = testode1(t,y)
global ii A B K
dy = [exp(-ii*t); y(1)]; %%%error due to a 2x2 from exp(-ii*t) here
end
1 Comment
Paul
on 19 Aug 2023
I realize that I'm only seeing a snippet of the material ....
u_s(t) shouldn't be in equation (86) because it's already been assumed that u_s(t>=0) = 1 in the derivation of equation (86).
The statement immediately preceding equation (87) is incorrect. The system will only have a steady state response if a) all of the eigenvalues of A are in the open left half plane, or b) any eigenvalues of A in the closed right half plane are cancelled by zeros, as could be the case if A,B,C,D is a non-minimal realization.
Accepted Answer
More Answers (1)
Hi @Joe
For completeness, I am including an example of the full-state variable feedback simulation using the symbolic matrix exponential (expm) approach. Consider the state-space system:
Suppose the system input u(t) is given by
where r(t) is the reference input, and N is an input scaling factor designed to eliminate the steady-state tracking error for a step input. Consequently, the closed-loop system equation takes the form
The solution for the reference input is provided by the following formula:
syms t tau real
A = [0 1;
0 0]; % state matrix
B = [0;
1]; % input matrix
C = [1 0]; % output matrix
K = [1 2]; % feedback gain matrix
Ac = A - B*K; % closed-loop state matrix
r = 1; % reference input, unit step input, in this example
N = 1; % input scaling factor
x0 = [0; 0]; % initial condition
Phi = expm(Ac*t) % state transition matrix
% Solution of Nonhomogeneous Linear State Equations
x(t) = Phi*x0 + int(expm(Ac*(t - tau))*B*N*r, tau, 0, t)
y(t) = C*x(t)
figure(1)
fplot(y(t), [0 10]), grid on
title('Unit Step Response')
xlabel({'$t$'}, 'interpreter', 'latex', 'fontsize', 16)
ylabel({'$y(t)$'}, 'interpreter', 'latex', 'fontsize', 16)
Furthermore, it's worth noting that the unit step response displayed in Figure 1 yields the same response as shown in Figure 2 below, which is generated using the step() function.
figure(2)
sys = ss(Ac, B*N, C, 0);
step(sys, 10), grid on
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






