Simulating a 1 degree step input on a state space system (using transfer functions)

40 views (last 30 days)
HI all,
I've been trying to simulate the aircraft response to different control inputs using the state space method. The code first creates the matrices for the state space, then I let MATLAB create the state space model using the ss command. Then to look at the responses, I use the tf command to make transfer functions of the state space. These transfer functions are used to calculate the response to a a 1 degree step input. However, the command step does not give the correct results. So I tried using the lsim command, however, these results weren't correct either.
So my question is; how do i simulate a 1 degree step input on the state space in MATLAB?
P.S. I'm using college values for the state space and I have figures of how the output should look like.
-- Used code: --
% State matrix (aerodynamic stability derivatives, u - w - q - theta)
A = [0.00501 0.00464 -72.9 -31.34;
-.08570 -.54500 309 -7.4;
0.00185 -0.00767 -0.395 0.00132;
0 0 1 0];
% Input matrix (control coefficients, aileron - rudder)
B = [5.63;
-23.8;
-4.51576;
0];
% Output matrix
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1;
0 0.00316 0 0;
0 -0.00316 0 1];
% Direct matrix
D = 0;
% Creation of state space & transfer functions (u, w, q, theta)
state_space = ss(A,B,C,D);
transfer_function = tf(state_space);
% Input of elevator
input = [ones(1,10), zeros(1,991)]; % Step of 1 for 1 second (in combination with time vector)
t = 0:0.1:100; % Time vector
% Calculation of response to elevator
[u,Y1] = lsim(transfer_function(1,1),input,t); % Velocity, x-axis
[w,Y2] = lsim(transfer_function(2,1),input,t); % Velocity, z-axis
[q,Y3] = lsim(transfer_function(3,1),input,t); % Angular velocity, pitch rate
[theta,Y4] = lsim(transfer_function(4,1),input,t); % Pitch angle
[alfa,Y4] = lsim(transfer_function(5,1),input,t); % Pitch angle
[gamma,Y4] = lsim(transfer_function(6,1),input,t); % Pitch angle
subplot(6,1,1);
plot(t,u);
title('Linear velocity u [ft/s]');
subplot(6,1,2);
plot(t,w);
title('Linear velocity w [ft/s]');
subplot(6,1,3);
plot(t,q);
title('Angular velocity q [ft/s]');
subplot(6,1,4);
plot(t,theta);
title('Pitch angle Theta [rad]');
subplot(6,1,5);
plot(t,alfa);
title('Angle Alfa [rad]');
subplot(6,1,6);
plot(t,gamma);
title('Angle Gamma [rad]');
sgtitle('Boeing 747 response to 1 degree 1 second on elevator');
  3 Comments
Mathieu NOE
Mathieu NOE on 9 Nov 2020
yeap
this works for any type of U input signal
for step response , you have already a specific function :
help step
step Step response of dynamic systems.
[Y,T] = step(SYS) computes the step response Y of the dynamic system SYS.
The time vector T is expressed in the time units of SYS and the time
step and final time are chosen automatically. For multi-input systems,
independent step commands are applied to each input channel. If SYS has
NY outputs and NU inputs, Y is an array of size [LENGTH(T) NY NU] where
Y(:,:,j) contains the step response of the j-th input channel.
Marc Van de Guchte
Marc Van de Guchte on 9 Nov 2020
Thanks! When I changed the command from lsim to step I received the correct figures, however, the amplitude/values from my simulations are higher than those of the textbook.
The units of the created state space are in radian, is it possible that the difference in amplitude lies in the step command? With that I mean that the command uses a step of 1 radian in stead of 1 degree?
Thanks!

Sign in to comment.

Accepted Answer

Paul
Paul on 9 Nov 2020
Your original lsim command didn't really generate a step resonse. It generate the response to a positivie unit step input at t = 0 followed by a negative step input at t = 1. If you all you really want is the unit step response, then for sure just use the step command.
As for the units, the step command doesn't know anything about units. It just applies a unit step; the units are implicit in your model coefficients. If you developed your model coefficients in the B-matrix in units of rad^-1 (e.g., B(1,1) has units of ft/s^2/rad, then the step elevator input has units of rad, and the outputs of your model need to be intepreted appropriately, e.g. the fourth output would be: rad Theta per rad Elevator. Of course deg Theta per deg elevator would be the same. But if you wanted to deg Theta per rad Elevator you'd mutliply the fourth output of the step response by 180/pi.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!