- Define the transfer function:You can use the ‘tf’ function in MATLAB to create the transfer function G(s)
- Plot the root locus: Use the ‘rlocus’ function to plot the root locus and visually inspect the stability region.
- Use ‘rlocfind’ to interactively select gain: If you want to interactively select a gain and see the corresponding closed-loop poles, you can use the rlocfind function.
How to use rlocfind in root locus.
1 009 views (last 30 days)
Show older comments
How do i use rlocfind command to find the range of values of K (feedback gain) for which the closed-loop ststem is stable. For example for the sytem below:
In the tutorial it is hinted that rlocfind is the correct appraoch:
Many thanks in advance,
0 Comments
Accepted Answer
Askic V
on 8 Mar 2023
Edited: Arkadiy Turevskiy
on 19 Jun 2024
You could start with this:
help tf
help rlocfind
Additional comments from Siddharth Jawahar at MathWorks 0n 6/18/2024:
Suppose you have a simple first-order system defined by the transfer function:
G(s)= 1/(s^2+2*s+1)
You want to find the values of gain K that keep this system stable in a closed-loop configuration when combined with unity feedback.
Here's how you can put this all together in MATLAB
% Define the transfer function
s = tf('s');
G = 1 / (s^2 + 2*s + 1);
% Plot the root locus
figure;
rlocus(G);
title('Root Locus of G(s) = 1/(s^2+ 2s + 2)');
% Optionally, use rlocfind to select gain and see the poles
[K, poles] = rlocfind(G);
While the ‘rlocfind’ function allows you to interactively select a gain and observe the corresponding closed-loop poles, this approach does not directly give you a range of gain values for which your system remains stable. Instead, I recommend using the ‘margin’ command for determining a range of stable gain values. The ‘margin’command in MATLAB calculates the gain margin, which indicates how much the system's gain can be increased without causing instability. With this measure, along with the phase margin, it helps you understand your control system's robustness. This allows you to estimate a safe range of gains that ensure the system remains stable.
Please see these examples on how to use the margin command to determine the gain and phase margins for control systems.
2 Comments
Askic V
on 8 Mar 2023
Can you show us your code?
Did you try to use margin() function?
Gm = margin (g); % g = tf(num,den)
Did you get the same or different value compared to rlocfind?
More Answers (2)
Helin Qais
on 4 May 2023
To use the `rlocfind` command to find the range of values of K (feedback gain) for which the closed-loop system is stable, you can follow these steps:
1. Define the open-loop transfer function `G(s)` and the feedback transfer function `H(s)` based on your system's characteristics.
2. Construct the closed-loop transfer function `T(s)` by combining `G(s)` and `H(s)` using the formula `T(s) = G(s)/(1 + G(s)H(s))`.
3. Use the `rlocfind` command in MATLAB or Octave to plot the root locus of the closed-loop transfer function `T(s)` and find the range of values of `K` for which the closed-loop system is stable. You can do this by following the prompts provided by the command.
4. Adjust the value of `K` until the closed-loop system is stable within the range of `K` found in step 3.
Here is an example of how to use the `rlocfind` command in MATLAB or Octave:
```matlab % Define the open-loop transfer function G(s) and the feedback transfer function H(s) G = tf([1], [1 2 1]); H = tf([1], [1]);
% Construct the closed-loop transfer function T(s) T = feedback(G*H, 1);
% Plot the root locus of T(s) using rlocfind rlocfind(T);
% Follow the prompts to find the range of values of K for which the closed-loop system is stable
% Adjust the value of K until the closed-loop system is stable within the range found in step 3 K = 0.5; T_closed_loop = feedback(K*G*H, 1); step(T_closed_loop); ```
In this example, the open-loop transfer function `G(s)` is `1/(s^2 + 2s + 1)` and the feedback transfer function `H(s)` is `1`. The closed-loop transfer function `T(s)` is constructed by combining `G(s)` and `H(s)` using the formula `T(s) = G(s)/(1 + G(s)H(s))`. The `rlocfind` command is used to plot the root locus of `T(s)` and find the range of values of `K` for which the closed-loop system is stable. Finally, the value of `K` is adjusted until the closed-loop system is stable within the range found using `rlocfind`.
0 Comments
Heal
on 13 May 2023
Rlocfind is a tool used in root locus analysis to find the gain and location of a closed-loop pole given a desired closed-loop pole location on the complex plane. Here are the steps to use rlocfind in root locus:
- Draw the root locus plot for the open-loop transfer function of the system using your preferred software or by hand.
- Identify the desired closed-loop pole location on the complex plane.
- Click on the rlocfind button in the root locus tool menu or use the command "rlocfind" in the MATLAB command window.
- Move the cursor near the desired closed-loop pole location on the root locus plot. The rlocfind tool will automatically calculate the gain required to place the closed-loop pole at that location and display it on the screen.
- Adjust the gain value if necessary and test the stability of the closed-loop system.
Note that rlocfind is a useful tool for quickly finding a closed-loop pole location, but it is not a substitute for a thorough analysis of the system's stability and performance characteristics.
0 Comments
See Also
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!