multiple equations to steady-state system to transfer function

69 ビュー (過去 30 日間)
erin
erin 2025 年 2 月 19 日 0:07
コメント済み: Sam Chak 2025 年 2 月 19 日 6:03
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 件のコメント
erin
erin 2025 年 2 月 19 日 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

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2025 年 2 月 19 日 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.
  1 件のコメント
erin
erin 2025 年 2 月 19 日 2:44
I did figure out a different solution for the first problem

サインインしてコメントする。


Sam Chak
Sam Chak 2025 年 2 月 19 日 2:54
編集済み: Sam Chak 2025 年 2 月 19 日 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 件のコメント
Sam Chak
Sam Chak 2025 年 2 月 19 日 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 2025 年 2 月 19 日 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"

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by