How is the function FEEDBACK implemented in Matlab?
3 views (last 30 days)
Show older comments
Hello together,
I used the function »feedback« to generate a closed-loop system, which worked well. Now I am trying to understand, how this function is mathematically implemented in Matlab. There are a lot of information’s, how to use the function, but I didn't find anything which describes how it’s working and implemented mathematically. Does this function use iterative every sample from the output and add it to the input?
Thank you!
0 Comments
Accepted Answer
Ameer Hamza
on 16 Oct 2020
No, it does not use any input and output data points of systems to construct a feedback system. There is a closed-form expression to create feedback from two systems. Read here: https://en.wikipedia.org/wiki/Closed-loop_transfer_function and https://www.tutorialspoint.com/control_systems/control_systems_feedback.htm. It uses the transfer function of these two blocks and uses the expression
to create a feedback system.
3 Comments
Ameer Hamza
on 16 Oct 2020
Yes, there is a bit of a difference. If you simplify the result of G/(1+GH), it will be the same as feedback(). You can see in that example, both numerator and denominator are multiplied by the same factor, which adds poles and zeros at the same locations.
Paul
on 8 Aug 2024
As of R2022a,
For the command:
%C = feedback(G,H)
If G and H are both SISO tf objects, then C is computed with polynomial algebra based on the numerator and denominator of G and H respectively.
If G and H are both tf objects, but either is not SISO, then both are converted to ss objects, C is formed from the state space matrices, and then converted back to tf.
If G and H are both zpk objects, they are both converted to ss, C is formed from the state space matrices, then converted back to zpk.
If G and H are both ss objects, then form C from the state space matrices.
If one of G or H is zpk and the other tf, then the tf is converted to zpk, and proceed as above (returns zpk).
If one of G or H is ss, then convert the other to ss and proceed as above (returns ss).
%G/(1 + G*H)
is implemented as a sequence of algebraic operations. Consider G(s) and H(s) defined as follows:
G = zpk(-1,[-2,-3],1); H = zpk([],-1,1);
Walk through the algebra, step by step
temp = G*H
temp = 1 + temp
G/temp
which is the same as
C = G/(1+G*H)
We see that clearing the polynomial fractions led to phantom poles and zero at s = -2 and s = -3.. We see that there is also a common pole/zero at s = -1, which still hanging around from the pole and zero at that location in H(s) and G(s) respectively.
minreal(C,1e-7)
which gets rid of the poles/zeros at s = -2/-3, but also eliminates the pole/zero at s = -1 (which might or might not be a desirable result).
C = feedback(G,H)
and the pole/zero at s = -1 remains in the result, (which could subsequently be removed via minreal if so desired
minreal(C)
Note that minreal worked here with the default tolerance, which is considerably smaller than 1e-7 that was needed after the algebraic approach.
Also, ss is preferred over zpk, and zpk is preferred over tf.
More Answers (1)
Ntokozo
on 7 Aug 2024
Use MATLAB commands to find G(s) expressed as factors in the numerator divided by factors in the denominator.
0 Comments
See Also
Categories
Find more on Dynamic System Models 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!