|
Using
Simulink to Simplify the Process of Building a Feedback Loop
In Control System Design, a feedback loop is often used
in designing a feedback controller. Let's take an oven as
an example, the temperature inside an oven is continuously
monitored and feedback to the controller such that the oven
temperature is maintained close to the desired temperature.
To model this feedback controller, either MATLAB or Simulink
will be sufficient to design and construct this system. However,
when dealing with complex feedback controller which involves
multiple inputs and multiple outputs, it is easier to be accomplished
using Simulink.
Let's
first consider a simple feedback loop as shown below, by using
MATLAB you can compute the closed-loop transfer function H
from r to y either using:
1. the
formula, or
2.
the 'feedback' command

1.
Using the formula:
To compute the closed-loop transfer function H for the above
system, the following formula is used.
Type:
>>G = tf([1 2],[1 .5 3]);
>>K = 2;
>>H = G/(1+G*K)
The following
transfer function will be obtained.
Transfer
function:
s^3 +
2.5 s^2 + 4 s + 6
-----------------------------------
s^4 + 3 s^3 + 11.25 s^2 + 11 s + 21
2. Using
the 'feedback' command:
To compute
the closed-loop transfer function H using 'feedback' command.
Type
>>G
= tf([1 2],[1 .5 3]);
>>K = 2;
>>H2 = feedback(G,K)
The following
transfer function will be obtained.
s + 2
---------------
s^2 + 2.5 s + 7
A major
issue with using the formula is that it increases the order
of the closed-loop transfer function. In the example above,
H is double the order of H2. This is because the expression
G/(1+G*K) is evaluated as a ratio of the two transfer functions
G and 1+G*K. If

then G/(1+G*K)
is evaluated as:

Therefore,
the poles of G are added to both the numerator and denominator
of H. These excess poles and zeros will negatively impact
the accuracy of your results when dealing with high-order
transfer functions
If the
feedback loop is complex, i.e. involves multi-input multi-output
system, it is difficult to build the feedback loop using the
methods mentioned above. For example, consider a state-space
plant model 'a' with five inputs and four outputs and a state-space
feedback controller 'b' with three inputs and two outputs.
It is required to connect outputs 1, 3, and 4 of the plant
to the controller inputs, and the controller outputs to inputs
4, 5 and 2, 3 of the plant.
To model
and construct this feedback loop, it is recommended to use
the command 'connect' in MATLAB.Click here to download the MATLAB script used to
model this feedback loop.
However,
it is much easier to build the feedback loop using Simulink
as it provides you with the intuitive 'drag-and-drop' graphical
user interface (GUI) for building the feedback loop using
block diagrams, allowing you to draw the feedback loop just
as you would do with pencil and paper. Thus you can visualize
the whole system clearly. Besides, when you want to make any
modification to the system, for example changing the number
of inputs and outputs of the multi-input multi-output system,
adding in more transfer function blocks, etc, it is easier
and faster to be done in Simulink compared to MATLAB. This
is because you will need to make more changes to the MATLAB
algorithm compared to the Simulink model you have built. Click here to download the Simulink model used for this feedback controller.
The Simulink
model is as shown below. You can perform simulation and compare
it against the transfer function computed using the connect
command in MATLAB. The result is exactly the same showing
you that both methods are applicable, the difference is on
the ease of building the feedback loop only.

Algorithm
Development Made Easy with latest MATLAB 7.5 (R2007b)
Do you know that the MATLAB Editor is now enhanced with exciting
and useful features to facilitate the algorithm development
process? We are sharing a few here with you:
Enhancement
to Help in Command Window and Editor
To get help for a function in the Command Window or the Editor,
you can now highlight the function name and press F1.
The reference page for that function appears in a small, temporary
(pop-up) window. To close the window, press Escape.

Run
Function M-Files in the Editor Using Configurations
In the Editor, you can provide values for a function's input
arguments using a configuration, and then run that configuration
to use the assigned values. Use a configuration as an alternative
to running the function in the Command Window. You can associate
multiple configurations with an M-file, each for different
input values.
To
create a configuration, first open an M-file in the Editor.
Then, from the down arrow on the Run button
in the toolbar, select Edit Configurations for filename.
In the resulting Edit M-File Configurations dialog box, add
statements and name the configuration.

Code
Folding Feature for Collapsing and Expanding Code
To improve the readability of files containing several subfunctions,
the Editor now includes a code folding feature, which is enabled
by default. Using this feature you can collapse and expand
subfunctions and their associated help. The following figure
shows the collatzplot_new function collapsed, such
that only the function definition is displayed. The figure
shows the collatz function expanded, revealing both
the help code and the function code. If you collapse just
the help code, only the H1 help line displays.

- To
expand code that is collapsed, click the plus sign (+) to
the left of the code you want to expand.
- To
collapse code that is expanded, click the minus sign (-)
to the left of the code you want to collapse.
- To
expand or collapse all of the code in an M-file, place your
cursor anywhere within the M-file, right-click, and then
select Code Folding > Expand All or Code Folding
> Collapse All from the context menu.
For more
information on other latest features or enhancement to MATLAB
7.5, kindly acess http://www.mathworks.com/products/matlab/whatsnew.html
for further details.
|