Write a MATLAB proigram to find the overall transfer function if the system is c
ID: 1715690 • Letter: W
Question
Write a MATLAB proigram to find the overall transfer function if the system is connect as follows. Make comments for each step.
G1 = tf([0 10],[1 1]);
G2 = tf([0 1],[0 1]);
G3 = tf([0 5],[1 6]);
G4 = tf([0 0 10],[1 2 0]);
G5 = tf([1 0],[0 1]);
G6 = tf([0 10],[0 1]);
G7 = tf([0 1],[1 4]);
%Appending of the system
Ta = append(G1,G2,G3,G4,G5,G6,G7);
%Q Matrix, shows the connections between the subsystems
Q = [1 -2 8 0
2 1 0 0
3 1 0 0
4 3 -5 0
5 4 0 0
6 4 0 0
7 8 0 0];
inputs = 7;
outputs = 5;
Tr = connect(Ta,Q,inputs,outputs);
T = tf(Tr)
I have no idea why I keep getting this error:
Some indices in row 1 of the Q matrix are out of range. In connect(BLKSYS,Q,...), the first column of Q must contain indices within the range of inputs of
BLKSYS and the remaining columns must contain indices within the range of outputs of BLKSYS.
Explanation / Answer
Open a new script file and then copy the below code
Code:
clc;
%Given G1 transfer function
G1 = tf([0 10],[1 1])
%Given G2 transfer function
G2 = tf([0 1],[0 1]);
%Given G3 transfer function
G3 = tf([0 5],[1 6]);
%Given G4 transfer function
G4 = tf([0 0 10],[1 2 0]);
%Given G5 transfer function
G5 = tf([1 0],[0 1]);
%Given G6 transfer function
G6 = tf([0 10],[0 1]);
%Given G7 transfer function
G7 = tf([0 1],[1 4]);
%Feedback of G1 and G2
H1 = feedback(G1,G2)
%Feedback of G4 and G5
H2 = feedback(G4,G5)
%Feedback of G1 and G2,Feedback of G4 and G5, G3 and G6 are in series. So,
%mulplify all the specified terms.
H3 = H1 * G3 * H2 * G6
%G7 and above term is in parallel. So, add the two terms.
Ts = G7 + H3
ouput:
G1 =
10
-----
s + 1
Continuous-time transfer function.
H1 =
10
------
s + 11
Continuous-time transfer function.
H2 =
10
----------
s^2 + 12 s
Continuous-time transfer function.
H3 =
5000
------------------------------
s^4 + 29 s^3 + 270 s^2 + 792 s
Continuous-time transfer function.
Ts =
s^4 + 29 s^3 + 270 s^2 + 5792 s + 20000
------------------------------------------
s^5 + 33 s^4 + 386 s^3 + 1872 s^2 + 3168 s
Continuous-time transfer function.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.