How to use rlocfind in root locus.

1.010 visualizzazioni (ultimi 30 giorni)
Thomas
Thomas il 8 Mar 2023
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,

Risposta accettata

Askic V
Askic V il 8 Mar 2023
Modificato: Arkadiy Turevskiy il 19 Giu 2024
You could start with this:
help tf
TF Construct transfer function or convert to transfer function. Construction: SYS = TF(NUM,DEN) creates a continuous-time transfer function SYS with numerator NUM and denominator DEN. SYS is an object of type TF when NUM,DEN are numeric arrays, of type GENSS when NUM,DEN depend on tunable parameters (see REALP and GENMAT), and of type USS when NUM,DEN are uncertain (requires Robust Control Toolbox). SYS = TF(NUM,DEN,TS) creates a discrete-time transfer function with sample time TS (set TS=-1 if the sample time is undetermined). S = TF('s') specifies the transfer function H(s) = s (Laplace variable). Z = TF('z',TS) specifies H(z) = z with sample time TS. You can then specify transfer functions directly as expressions in S or Z, for example, s = tf('s'); H = exp(-s)*(s+1)/(s^2+3*s+1) SYS = TF creates an empty TF object. SYS = TF(M) specifies a static gain matrix M. You can set additional model properties by using name/value pairs. For example, sys = tf(1,[1 2 5],0.1,'Variable','q','IODelay',3) also sets the variable and transport delay. Type "properties(tf)" for a complete list of model properties, and type help tf.<PropertyName> for help on a particular property. For example, "help tf.Variable" provides information about the "Variable" property. By default, transfer functions are displayed as functions of 's' or 'z'. Alternatively, you can use the variable 'p' in continuous time and the variables 'z^-1', 'q', or 'q^-1' in discrete time by modifying the "Variable" property. Data format: For SISO models, NUM and DEN are row vectors listing the numerator and denominator coefficients in descending powers of s,p,z,q or in ascending powers of z^-1 (DSP convention). For example, sys = tf([1 2],[1 0 10]) specifies the transfer function (s+2)/(s^2+10) while sys = tf([1 2],[1 5 10],0.1,'Variable','z^-1') specifies (1 + 2 z^-1)/(1 + 5 z^-1 + 10 z^-2). For MIMO models with NY outputs and NU inputs, NUM and DEN are NY-by-NU cell arrays of row vectors where NUM{i,j} and DEN{i,j} specify the transfer function from input j to output i. For example, H = tf( {-5 ; [1 -5 6]} , {[1 -1] ; [1 1 0]}) specifies the two-output, one-input transfer function [ -5 /(s-1) ] [ (s^2-5s+6)/(s^2+s) ] Arrays of transfer functions: You can create arrays of transfer functions by using ND cell arrays for NUM and DEN above. For example, if NUM and DEN are cell arrays of size [NY NU 3 4], then SYS = TF(NUM,DEN) creates the 3-by-4 array of transfer functions SYS(:,:,k,m) = TF(NUM(:,:,k,m),DEN(:,:,k,m)), k=1:3, m=1:4. Each of these transfer functions has NY outputs and NU inputs. To pre-allocate an array of zero transfer functions with NY outputs and NU inputs, use the syntax SYS = TF(ZEROS([NY NU k1 k2...])) . Conversion: SYS = TF(SYS) converts any dynamic system SYS to the transfer function representation. The resulting SYS is always of class TF. See also TF/EXP, FILT, TFDATA, ZPK, SS, FRD, GENSS, USS, DYNAMICSYSTEM. Documentation for tf doc tf Other uses of tf control/tf DynamicSystem/tf rffilter.rffilter/tf dsp.AllpassFilter/tf idParametric/tf signal/tf dsp.Channelizer/tf mpc/tf StaticModel/tf dsp.NotchPeakFilter/tf
help rlocfind
RLOCFIND Find root locus gains for a given set of roots. [K,POLES] = RLOCFIND(SYS) is used for interactive gain selection from the root locus plot of the SISO system SYS generated by RLOCUS. RLOCFIND puts up a crosshair cursor in the graphics window which is used to select a pole location on an existing root locus. The root locus gain associated with this point is returned in K and all the system poles for this gain are returned in POLES. [K,POLES] = RLOCFIND(SYS,P) takes a vector P of desired root locations and computes a root locus gain for each of these locations (i.e., a gain for which one of the closed-loop roots is near the desired location). The j-th entry of the vector K gives the computed gain for the location P(j), and the j-th column of the matrix POLES lists the resulting closed-loop poles. See also RLOCUS. Other uses of rlocfind DynamicSystem/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.
  1. Define the transfer function:You can use the ‘tf’ function in MATLAB to create the transfer function G(s)
  2. Plot the root locus: Use the ‘rlocus’ function to plot the root locus and visually inspect the stability region.
  3. 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.
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 Commenti
Askic V
Askic V il 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?
Adri
Adri il 30 Apr 2023
GM = margen (g) ;

Accedi per commentare.

Più risposte (2)

Helin Qais
Helin Qais il 4 Mag 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`.

Heal
Heal il 13 Mag 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:
  1. Draw the root locus plot for the open-loop transfer function of the system using your preferred software or by hand.
  2. Identify the desired closed-loop pole location on the complex plane.
  3. Click on the rlocfind button in the root locus tool menu or use the command "rlocfind" in the MATLAB command window.
  4. 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.
  5. 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.

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by