# I am having trouble to define in matlab the transfer function of the following block diagram.

4 views (last 30 days)
Jake on 12 Feb 2024
Answered: Sam Chak on 17 Feb 2024
The systems Information for Modelling:
G1(s) = ﻿Front left motor.
G2(s) = ﻿Front right motor.
G3(s) = ﻿Rear left motor.
G4(s) = ﻿Rear right motor.
For a quadcopter all motors are identical which means, G1(s) = ﻿G2(s) = ﻿G3(s) = ﻿G4(s)
PID(s) = ﻿PID controller transfer function
do = ﻿Output disturbance
F(s) = ﻿Sensor feedback transfer function, defined as:
F(s)= 1100/(s+1100)
G1= 774 / (s^2 + 37.2 * ﻿s + 8649)
Kp =1
D= 0.5

Sam Chak on 17 Feb 2024
In order to obtain the transfer function of the plant, you can likely perform the algebraic manipulations in the manner as suggested. However, I must mention that I excluded the consideration of the output disturbance and sensor in the controller design.
syms s u K y
%% Transfer function of the motor
G = 774/(s^2 + 37.2*s + 8649)
G =
u1 = K*y + 1*u - 1*u; % don't understand why add and cancel out
u2 = -u;
u3 = u;
u4 = -u;
eqn = y - (1.1*G*u1 - 1.1*G*u2 + 1.1*G*u3 - 1.1*G*u4) == 0;
ySol = isolate(eqn, y)
ySol =
ySol = subs(ySol, K, 23064/2365) % K = 23064/2365 (free parameter to be designed)
ySol =
%% Transfer function of the Plant
Gp = tf(12771, [5 186 8649/5])
Gp = 12771 -------------------- 5 s^2 + 186 s + 1730 Continuous-time transfer function.
%% Transfer function of the PIDF controller
Gc = pidtune(Gp, 'PIDF')
Gc = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = 0.275, Ki = 3.58, Kd = 0.00475, Tf = 0.000441 Continuous-time PIDF controller in parallel form.
%% Transfer function of the Closed-loop system
Gcl = feedback(Gc*Gp, 1);
%% Step-response of the Closed-loop system
step(Gcl, 0.6), grid on

### Categories

Find more on Classical Control Design in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!