Discrete state space find and plot
6 次查看(过去 30 天)
显示 更早的评论
A = [0 1 0 0 0; -0.4 -1.3 0 0 0; 0 0 2 0 0; 0 0 0 0 -0.4; 0 0 0 1 -1.3];
B = [0; 1; 0; 0; 0];
C = [0 0 0 0 1];
x0 = transpose([0 0 0 0 0]); % initial condition
u = 1(k) % unit step
Find and plot:
x(k + 1) = A*x(k) + B*u(k)
How do I do this without using ss() and lsim(), and instead by using a for loop for 100 time units?
Thanks
0 个评论
采纳的回答
bio lim
2016-12-3
编辑:bio lim
2016-12-3
Well, the nice thing about discrete time system is you can solve the discrete time equation with a loop.
clc;
clear all;
close all;
A = [0 1 0 0 0; -0.4 -1.3 0 0 0; 0 0 2 0 0; 0 0 0 0 -0.4; 0 0 0 1 -1.3];
B = [0; 1; 0; 0; 0];
C = [0 0 0 0 1];
x0 = transpose([0 0 0 0 0]); % initial condition
u = 1; % unit step
x(:,1) = A*x0 + B.*u;
% x(k + 1) = A*x(k) + B*u(k)
for k = 2:100
x(:,k) = A*x(:,k-1) + B*u;
end
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stability Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!