multiple equations to steady-state system to transfer function

14 views (last 30 days)
Part 1:
This is the steady-state system I found :
A=[0 0 1 0;
0 0 0 1;
(-k1-k2)/m1 k2/m1 0 0;
(-k2-k3)/m2 k2/m2 0 0];
B=[0 0; 0 0; -1/m1 0; 1/m2 1/m2];
C=[1 0 0 0;0 0 1 0];
D=[];
found using the following equations
๐‘š1๐‘งฬˆ1 = โˆ’๐‘˜1๐‘ง1 โˆ’ ๐‘˜2(๐‘ง1 โˆ’ ๐‘ง2) โˆ’ ๐‘ข1 and
๐‘š2๐‘งฬˆ2 = โˆ’๐‘˜2(๐‘ง2 โˆ’ ๐‘ง1) โˆ’ ๐‘˜3๐‘ง2 + ๐‘ข1 + ๐‘ข2
Here I was instructed to find one of the transfer functions (such as Z1(s)/U1(s))
Part 2: I got the steady-state system
A=[-0.12 -6.2 -785 32.2;
-0.11 -11.23 5.51 0;
0.0002 -0.5 -5.94 0;
0 1.02 0 0];
B=[21.04 0; 8.87 -23.34; -0.09 0.01; 0 0];
C=[1 1 1 1; 1 1 1 0; 1 1 1 0; 0 1 0 0];
D=[];
which was found using the below equations:
๐›ฅ๐›ฝฬ‡ = โˆ’0.12๐›ฅ๐›ฝ โˆ’ 6.20โˆ†๐‘ โˆ’ 785.0โˆ†๐‘Ÿ + 32.2โˆ†๐œ‘ + 21.04โˆ†๐›ฟ๐‘Ÿ
โˆ†๐‘ฬ‡ = โˆ’0.11โˆ†๐›ฝ โˆ’ 11.23โˆ†๐‘ + 5.51๐‘Ÿโˆ† โˆ’ 23.34โˆ†๐›ฟ๐‘Ž + 8.87โˆ†๐›ฟ๐‘Ÿ
โˆ†๐‘Ÿฬ‡ = 0.0002๐›ฅ๐›ฝ โˆ’ 0.50โˆ†๐‘ โˆ’ 5.94โˆ†๐‘Ÿ + 0.01๐›ฅ๐›ฟ๐‘Ž โˆ’ 0.09โˆ†๐›ฟ๐‘Ÿ
โˆ†๐œ‘ฬ‡ = 1.02โˆ†๐‘
Here I was supposed to find the transfer functions: ๐›ฅ๐›ฝ/๐›ฟ๐‘Ÿ and ๐‘Ÿ/๐›ฟ๐‘Ž
In both instances I used the following code but the upon running the files, the code would keep running whenever it got to "transferfunction" and wouldn't stop or actually give me the transfer functions. Each time I'd have to manually stop the code in order to use it. What am I doing wrong here?
clear all
clc
%part 1
syms k1 k2 m1 m2 k3
A=[0 0 1 0;
0 0 0 1;
(-k1-k2)/m1 k2/m1 0 0;
(-k2-k3)/m2 k2/m2 0 0];
B=[0 0; 0 0; -1/m1 0; 1/m2 1/m2];
C=[1 0; 0 1];
D=[];
system1=ss(A,B,C,D)
transferFunction=tf(system1)
clear all
clc
%part 2
A=[-0.12 -6.2 -785 32.2;
-0.11 -11.23 5.51 0;
0.0002 -0.5 -5.94 0;
0 1.02 0 0];
B=[21.04 0; 8.87 -23.34; -0.09 0.01; 0 0];
C=[1 1 1 1; 1 1 1 0; 1 1 1 0; 0 1 0 0];
D=[];
system1=ss(A,B,C,D)
transferFunction=tf(system1)
  1 Comment
erin
erin on 19 Feb 2025 at 2:41
I figured out how to solve the first one but I'm still struggling on how to find those specific transfer functions in part 2

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 19 Feb 2025 at 2:42
The Control System Toolbox functions, such as ss and tf do not support symbolic variables at all. There are very very few functions in the Control System Toolbox that support symbolic variables.
In https://www.mathworks.com/matlabcentral/answers/305339-how-to-create-a-transfer-function-with-gain-k#comment_395202 I explore what is actually possible for Control System Toolbox in turns of making parameterized systems.

Sam Chak
Sam Chak on 19 Feb 2025 at 2:54
Edited: Sam Chak on 19 Feb 2025 at 5:53
Part 1 of your code does not work because the tf() function from the Control System Toolbox is primarily used for creating transfer functions, which are dynamical system objects, and it does not directly support symbolic computations. Part 2 is purely numerical, so the code in that section works.
๐›ฅ๐›ฝฬ‡ = โˆ’0.12๐›ฅ๐›ฝ โˆ’ 6.20โˆ†๐‘ โˆ’ 785.0โˆ†๐‘Ÿ + 32.2โˆ†๐œ‘ + 21.04โˆ†๐›ฟ๐‘Ÿ
โˆ†๐‘ฬ‡ = โˆ’0.11โˆ†๐›ฝ โˆ’ 11.23โˆ†๐‘ + 5.51๐‘Ÿโˆ† โˆ’ 23.34โˆ†๐›ฟ๐‘Ž + 8.87โˆ†๐›ฟ๐‘Ÿ
โˆ†๐‘Ÿฬ‡ = 0.0002๐›ฅ๐›ฝ โˆ’ 0.50โˆ†๐‘ โˆ’ 5.94โˆ†๐‘Ÿ + 0.01๐›ฅ๐›ฟ๐‘Ž โˆ’ 0.09โˆ†๐›ฟ๐‘Ÿ
โˆ†๐œ‘ฬ‡ = 1.02โˆ†๐‘
๐›ฅ๐›ฝ/๐›ฟ๐‘Ÿ and ๐‘Ÿ/๐›ฟ๐‘Ž
%% part 2
% state matrix
A = [-0.12 -6.2 -785 32.2;
-0.11 -11.23 5.51 0;
0.0002 -0.5 -5.94 0;
0 1.02 0 0];
% input matrix
B = [21.04 0;
8.87 -23.34;
-0.09 0.01;
0 0];
% output matrix
C = [1 0 0 0;
0 0 1 0];
% direct matrix
D = 0*C*B;
% state-space model
sys = ss(A, B, C, D, 'StateName', {'beta', 'p', 'r', 'phi'}, 'InputName', {'dr', 'da'})
sys = A = beta p r phi beta -0.12 -6.2 -785 32.2 p -0.11 -11.23 5.51 0 r 0.0002 -0.5 -5.94 0 phi 0 1.02 0 0 B = dr da beta 21.04 0 p 8.87 -23.34 r -0.09 0.01 phi 0 0 C = beta p r phi y1 1 0 0 0 y2 0 0 1 0 D = dr da y1 0 0 y2 0 0 Continuous-time state-space model.
% convert MIMO state-space to multiple transfer functions
G = tf(sys)
G = From input "dr" to output... 21.04 s^3 + 376.9 s^2 + 5704 s + 1714 1: ------------------------------------------ s^4 + 17.29 s^3 + 71 s^2 + 52.84 s + 21.42 -0.09 s^3 - 5.452 s^2 + 0.6014 s - 0.2669 2: ------------------------------------------ s^4 + 17.29 s^3 + 71 s^2 + 52.84 s + 21.42 From input "da" to output... 136.9 s^2 - 9156 s - 4552 1: ------------------------------------------ s^4 + 17.29 s^3 + 71 s^2 + 52.84 s + 21.42 0.01 s^3 + 11.78 s^2 + 1.436 s - 0.1172 2: ------------------------------------------ s^4 + 17.29 s^3 + 71 s^2 + 52.84 s + 21.42 Continuous-time transfer function.
%% To access specific transfer function, enter: G(output order, input order)
% beta is Output #1
% r is Output #2
% ฮดr is Input #1
% ฮดa is Input #2
%% beta/ฮดr
Gbr = G(1,1)
Gbr = From input "dr" to output: 21.04 s^3 + 376.9 s^2 + 5704 s + 1714 ------------------------------------------ s^4 + 17.29 s^3 + 71 s^2 + 52.84 s + 21.42 Continuous-time transfer function.
%% r/ฮดa
Gra = G(2,2)
Gra = From input "da" to output: 0.01 s^3 + 11.78 s^2 + 1.436 s - 0.1172 ------------------------------------------ s^4 + 17.29 s^3 + 71 s^2 + 52.84 s + 21.42 Continuous-time transfer function.
  2 Comments
Sam Chak
Sam Chak on 19 Feb 2025 at 3:06
Your output matrix has 4 rows, and the input matrix has 2 columns; thus, it implies that there are four outputs for each input signal. Since a transfer function can only describe a Single Input, Single Output (SISO) relationship, there is a total of eight transfer functions in the results.
You need to identify which specific rows in represent ฮฒ and r, as well as which specific columns in represent the input signals (rudder) and (aileron), in order to determine the corresponding transfer functions for ฮฒ/ฮดr and r/ฮดa.
Sam Chak
Sam Chak on 19 Feb 2025 at 6:03
For Part 2, the desired outputs are (state 1) and (state 3). I discovered that your output matrix is incorrect because the first three outputs {, , } are not linear combinations of the states. Therefore, I corrected the code in my Answer and demonstrated an approach to access the desired transfer functions ฮฒ/ฮดr and r/ฮดa"

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!