Problem understanding MATLAB 'feedback' command documentation

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.

 Accepted Answer

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

Hi Ameer,
Thank you for you answer.
However I am still unsure of this.
The equation in your response does make sense to me: =
However the example I mentioned on the feedback documentation page: https://www.mathworks.com/help/control/ref/feedback.html, has feedback gain of unity (+1).
Therefore, unless I am mistaken, there is no reason to consider the case of H_new(s) = -1. In fact, the case of H_new(s) = -1 'cancels out' the effect of the negative feedback. This gives the control system positive feedback. However the documentation says the command is for negative feedback. This is why I am still confused.
Also could you please explain which H(s) you are referring to when you say "H(s) = -1"? Is this the that I considered, or the 'H(s)' in the loop path (as in your wikipedia link).
I appreciate your help.
Thanks again.
Oh!!! Yes, you are absolutely correct. I missed this point in the documentation. The feedback() function assumes negative feedback by default, so there is no need to put a -1 as the second input. I think they have made a mistake in the example. Following is the correct syntax for negative feedback.
H = tf([1],[1 1 0])
W = pid(1,0,0,0) % standard pid input is: pid(Kp,Ki,Kd,Tf)
cl_sys = feedback(W*H, 1)
Also, you are right. H(s)=1 according to the block diagram on wikipedia page.
Thank you Ameer.
Do you know to whom I can report this mistake? I think this may affect other users too so I am keen on getting this resolved (if it truly is a mistake).
I appreciate your help and speedy replies!
Just a quick update - it has been confirmed as a typo in the documentation.
Good that it finally got noticed. It will avoid a lot of confusion for the readers.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!