Problem understanding MATLAB 'feedback' command documentation
5 views (last 30 days)
Show older comments
Manoj Abhishetty
on 26 Apr 2020
Commented: Ameer Hamza
on 29 Apr 2020
Hello,
I am having some trouble understanding the documentation for the 'feedback' command in MATLAB and I would appreciate some help. This question may be long so please bear with me!
The link to the documentation is here: https://www.mathworks.com/help/control/ref/feedback.html
In the first example: 'Plant and Controller with Unit Feedback', the diagram has two blocks connected in series. The loop is then closed in unity, negative feedback.
The example explains that to create the negative feedback loop, the following command should be used:
sys = feedback(G*C,-1)
where 'G' and 'C' are the two blocks connected in series.
However I have tried to do this myself and I cannot make sense of the results.
For example, suppose there is a plant 'H' with transfer function:
and a simple proportional controller with unit gain:
.


These can be set up with the following code:
H = tf([1],[1 1 0])
W = pid(1,0,0,0) % standard pid input is: pid(Kp,Ki,Kd,Tf)
Suppose the blocks are connected in series and the loop closed with unity, negative feedback. Then the transfer function between the input and output should be:

For this system, this becomes:
=
=
.



However if I run the unity negative feedback command suggested:
cl_sys = feedback(W*H,-1)
I get 

Where have I gone wrong? I'd appreciate any help. Thanks.
0 Comments
Accepted Answer
Ameer Hamza
on 26 Apr 2020
In your hand-calculations, you didn't consider the feedback gain. The actual transfer function of a closed-loop function is this
In your case, you considered G(s) = H(s)W(s), but you didn't consider H(s) = -1. If you take it into account, then you will get the same result as MATLAB.
7 Comments
Ameer Hamza
on 29 Apr 2020
Good that it finally got noticed. It will avoid a lot of confusion for the readers.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!