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?

1 view (last 30 days)
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 Comments
Tenzing Thiley
Tenzing Thiley on 20 Apr 2022
When I am using step function step() I am getting an error can you modify instead of initial can you change to step input
Mathieu NOE
Mathieu NOE on 20 Apr 2022
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('∆θ')

Sign in to comment.

Accepted Answer

Tenzing Thiley
Tenzing Thiley on 20 Apr 2022
Thanks

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!