# How to write this block diagram into Matlab in feed forward control form.

23 views (last 30 days)
Jake on 22 Apr 2024
Answered: Sam Chak on 23 Apr 2024
Hi, Im struggling to implement this block diagram into Matlab.
Ive got to reduce in into Feed forward control form and wondering if this is correct. I also have to use the Open-loop TF for bode and nyquist plots.
% Define the system's transfer functions as given in your brief
s = tf('s');
G1 = 774 / (s^2 + 37.2*s + 8649);
G2 = G1; % Since all motors are identical
G3 = G1;
G4 = G1;
% Define other transfer functions needed
PID = pid(1); % Proportional-only controller with Kp = 1
Fs = 1100 / (s + 1100); % Sensor feedback transfer function
Pitch = PID*(1*G1*1.2 + (1*G2*1.2) + (-1*G3*-1.2) + (-1*G4*-1.2)) / (1 + (PID*(1*G1*1.2 + (1*G2*1.2) + (-1*G3*-1.2) + (-1*G4*-1.2)) * Fs))
Pitch = 3715 s^15 + 5.054e06 s^14 + 1.397e09 s^13 + 4.231e11 s^12 + 7.334e13 s^11 + 1.315e16 s^10 + 1.626e18 s^9 + 2.042e20 s^8 + 1.866e22 s^7 + 1.73e24 s^6 + 1.158e26 s^5 + 7.972e27 s^4 + 3.663e29 s^3 + 1.813e31 s^2 + 4.589e32 s + 1.48e34 -------------------------------------------------------------------------------------------------------------------------------------------------------------- s^17 + 1398 s^16 + 4.353e05 s^15 + 1.437e08 s^14 + 2.829e10 s^13 + 5.626e12 s^12 + 8.028e14 s^11 + 1.137e17 s^10 + 1.231e19 s^9 + 1.316e21 s^8 + 1.091e23 s^7 + 8.963e24 s^6 + 5.568e26 s^5 + 3.476e28 s^4 + 1.508e30 s^3 + 6.85e31 s^2 + 1.662e33 s + 4.924e34 Continuous-time transfer function.
% Step response of the Pitch system
figure;
step(Pitch);
title('Step Response of Pitch');
grid on
% Bode plot for open-loop transfer function
figure;
bode(Pitch);
title('Open-loop Bode Plot');
% Nyquist plot for open-loop transfer function
figure;
nyquist(Pitch);
title('Open-loop Nyquist Plot');
% Thanks for the help

Gayatri on 23 Apr 2024
Hi Jake,
• You have correctly defined the individual motors (G1, G2, G3, G4) as identical with the given transfer function.
• You have defined a proportional-only controller using pid(1). If your system requires a full PID controller, you should specify the gains for PID accordingly. For a proportional-only controller, your approach is correct.
• For Bode and Nyquist plots, you typically examine the open-loop transfer function which does not include the feedback loop's effect. The open-loop transfer function is essentially the product of all transfer functions from the input to the output before the feedback is applied.
• If you need the step response of the system in a closed-loop configuration including the sensor feedback, you should use the "feedback" function to properly include the sensor feedback loop as below:
% Closed-loop system with sensor feedback
ClosedLoop = feedback(OpenLoop * Fs, 1);
Please refer the below documentation for feedback function: https://www.mathworks.com/help/control/ref/inputoutputmodel.feedback.html
I hope it helps!

Sam Chak on 23 Apr 2024
Around two months ago, you had a similar problem, but we didn't receive any feedback from you regarding whether the proposed mathematical solution was satisfactory or not. It would be helpful if you could review it so that we can consider the question resolved.
Regarding the current problem, the 'Pitch' transfer function obtained from your direct formula (without K) differs from my approach. By setting the free parameter and assuming no output disturbance (), I was able to determine the process plant transfer function for the four combined rotors.
%% Process Plant
Gp = tf(23220, [5 186 0])
Gp = 23220 ------------- 5 s^2 + 186 s Continuous-time transfer function.
In Simulink, when using with your original preset Proportional Controller (), the output exhibits an oscillatory response with a 45% overshoot (as shown by the yellow curve). However, by employing an appropriate PD Controller, the overshoot can be eliminated while maintaining the same fast settling time (as depicted by the blue curve).
%% PD controller
Kp = 0.098040019870345;
Kd = 6.329004257886284e-4;
Tf = 0.020426189039706;
Gc = pid(Kp, 0, Kd, Tf)
Gc = s Kp + Kd * -------- Tf*s+1 with Kp = 0.098, Kd = 0.000633, Tf = 0.0204 Continuous-time PDF controller in parallel form.
%% Sensor
Fs = tf(1100, [1 1100])
Fs = 1100 -------- s + 1100 Continuous-time transfer function.
%% Step response
step(feedback(Gc*Gp, Fs), 0.5), grid on
%% Bode diagram
bode(Gc*Gp*Fs), grid on
%% Nyquist diagram
nyquist(Gc*Gp*Fs), grid on, ylim([-1.5 1.5])
##### 3 CommentsShow 1 older commentHide 1 older comment
Sam Chak on 23 Apr 2024
Hi Jake,
Initially, the value for wasn't provided, so I made the assumption that it is a free parameter. It can take on a value of zero or any real number. However, the specific value to be assigned to is known only by the original system designer. I will explore the feedback() method as you suggested.
By the way, if you find the solution in the previous problem helpful (click the link), please consider clicking 'Accept' ✔ on the answer to close the issue. Your feedback and support are greatly appreciated.
Jake on 23 Apr 2024
Thanks Sam,
I never recieved Ki, within the brief it also doesnt state that its needed or has a value. But it does mention its a malfunction so i believe i have to removed all the red lines from the system aswell as the sum block.

Sam Chak on 23 Apr 2024
I have successfully utilized the 'feedback()' function to obtain the same modeling result for as presented in my previous answer. This validation is crucial in confirming the accuracy of my proposed solution. In this case, remains unchanged at , but you have the privilege to define it as zero or any real number. I recommend discussing this matter with your research supervisor or team members.
It is also essential for your team to design the PID controller, to meet the desired performance requirements. I included it merely as a demonstration to eliminate the overshoot. The open-loop transfer function should be represented as 'Gc*Gp*Fs'.
If you find this solution helpful, please consider clicking 'Accept' ✔ on the answer and voting 👍 for it. Your support is greatly appreciated! By the way, you should also vote for other helpful answers as tokens of appreciation.
%% Define the motor's transfer functions
s = tf('s');
G1 = 774/(s^2 + 37.2*s + 8649);
G2 = G1; % Since all motors are identical
G3 = G1;
G4 = G1;
%% Design parameter
K = 4805/516; % defined by the user, can be zero or any real number
%% The lumped 4-rotor system modeling formula using feedback()
Gp = 2*feedback(G1*1.2, -K) + feedback(G2*1.2, -K) + feedback(G3*1.2, -K) + feedback(G4*1.2, -K);
Gp = minreal(Gp, 1e-3)
Gp = 4644 ------------- s^2 + 37.21 s Continuous-time transfer function.
% Define other transfer functions needed
% Gc = pid(1); % Proportional-only controller with Kp = 1
%% PD controller
Kp = 0.098040019870345;
Kd = 6.329004257886284e-4;
Tf = 0.020426189039706;
Gc = pid(Kp, 0, Kd, Tf)
Gc = s Kp + Kd * -------- Tf*s+1 with Kp = 0.098, Kd = 0.000633, Tf = 0.0204 Continuous-time PDF controller in parallel form.
%% Sensor
Fs = 1100/(s + 1100); % Sensor feedback transfer function
%% Closed-loop transfer function
Gcl = feedback(Gc*Gp, Fs);
% Gcl = Gc*Gp/(1 + (Gc*Gp*Fs)); % your closed-loop formula also works
Gcl = minreal(Gcl, 1e-3)
Gcl = 599.2 --------------------- s^2 + 48.41 s + 599.2 Continuous-time transfer function.
%% Step response of the Pitch system
figure;
step(Gcl, 0.5), grid on
%% Bode plot for open-loop transfer function
figure;
bode(Gc*Gp*Fs), grid on
%% Nyquist plot for open-loop transfer function
figure;
nyquist(Gc*Gp*Fs), grid on, ylim([-1.5 1.5])

### 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!