Simulating a 1 degree step input on a state space system (using transfer functions)
Mostrar comentarios más antiguos
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 comentarios
Paul
el 9 de Nov. de 2020
Hard to answer w/o seeing what you're getting and/or what you're expecting, though there is nothing wrong with the code you posted.
The comment on the B-matrix is proably incorrect. It appears that those coefficients are just for the elevator.
Also, there is no need to to go the transfer function. Just use:
y = lsim(state_space,u,t)
Mathieu NOE
el 9 de Nov. de 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
el 9 de Nov. de 2020
Respuesta aceptada
Más respuestas (1)
Given
, find the State-Space (SS) form.
, find the State-Space (SS) form.Draw the Signal Flow Graph (SFG) at
(which likely means the SFG representation derived from the SS form).
1 comentario
Sam Chak
el 2 de Dic. de 2025
Hi @Andrew

As far as I know, there is no specific function in the Control System Toolbox that can produce such a graph. However, I believe it may be possible to achieve this using directed and undirected graphs.

Categorías
Más información sobre Digital Filter Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!