Can anyone able to get me the step response from this code. I am trying to modify the initial response to step but unable to do so?
2 次查看(过去 30 天)
显示 更早的评论
A = [ -0.040493 9.8689 0 -9.81;
-0.0021967 -0.030908 1 0;
-0.013639 -0.015207 -0.42801 0;
0 0 1 0];
B = [3.2952 0 0 0;0 -0.0020488 -0.068204 0]';
C = [1 0 0 1];
D = 0;
K = [0.021937 2.93 0.24659 -2.9163; 2.5565 1.3199 1.4874 -3.9318];
Ke = [-0.80034 0.82799 -0.34548 0.76847]';
AA = [A-B*K B*K; zeros(4,4) A-Ke*C];
BB = [B;0 0;0 0;0 0;0 0]
CC = [C 0 0 0 0];
sys = ss(AA, eye(8), eye(8), eye(8));
t = 0:0.01:120;
x = initial(sys, [1;0;1;0; 0 ;0 ;0 ;0],t);
x1 = [1 0 0 0 0 0 0 0]*x';
x2 = [0 1 0 0 0 0 0 0]*x';
x3 = [0 0 1 0 0 0 0 0]*x';
x4 = [0 0 0 1 0 0 0 0]*x';
subplot(2,2,1); plot(t,x1); grid
xlabel('t (sec)'); ylabel('∆V')
subplot(2,2,2); plot(t,x2); grid
xlabel('t (sec)'); ylabel('∆α')
subplot(2,2,3); plot(t,x3); grid
xlabel('t (sec)'); ylabel('∆q')
subplot(2,2,4); plot(t,x4); grid
xlabel('t (sec)'); ylabel('∆θ')
4 个评论
Mathieu NOE
2022-4-20
A = [ -0.040493 9.8689 0 -9.81;
-0.0021967 -0.030908 1 0;
-0.013639 -0.015207 -0.42801 0;
0 0 1 0];
B = [3.2952 0 0 0;0 -0.0020488 -0.068204 0]';
C = [1 0 0 1];
D = 0;
K = [0.021937 2.93 0.24659 -2.9163; 2.5565 1.3199 1.4874 -3.9318];
Ke = [-0.80034 0.82799 -0.34548 0.76847]';
AA = [A-B*K B*K; zeros(4,4) A-Ke*C];
BB = [B;0 0;0 0;0 0;0 0]
CC = [C 0 0 0 0];
sys = ss(AA, eye(8), eye(8), eye(8));
t = 0:0.01:120;
% x = initial(sys, [1;0;1;0; 0 ;0 ;0 ;0],t);
opt = stepDataOptions('StepAmplitude',0.1);
x = step(sys,t,opt);
subplot(2,2,1); plot(t,x(:,1)); grid
xlabel('t (sec)'); ylabel('∆V')
subplot(2,2,2); plot(t,x(:,2)); grid
xlabel('t (sec)'); ylabel('∆α')
subplot(2,2,3); plot(t,x(:,3)); grid
xlabel('t (sec)'); ylabel('∆q')
subplot(2,2,4); plot(t,x(:,4)); grid
xlabel('t (sec)'); ylabel('∆θ')
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!