how to build a control system with one input and multiple outputs

2 views (last 30 days)
Jun Meng
Jun Meng on 21 Nov 2021
Commented: Jun Meng on 22 Nov 2021
hello~
I want to build a system like this. I don't know how to deal with the separate output from modul F

Accepted Answer

Paul
Paul on 21 Nov 2021
Edited: Paul on 21 Nov 2021
Here is one approach (there are others), with simple examples tf's for C, F, and G, that you should be able to adapt to your problem.
The trick is to replicate F so that it has two outputs. One output to add to G and the other to keep as the output of the closed loop system.
% Example data
C = tf(1,[1 0]);
F = tf(1,[1 1]);
G = tf(1,[1 2]);
% Create a new version of F that has two outputs that are the same as each
% other. One output of F will be added to the output of G and the other
% will be retained as the output of the system
Fnew = [F;F];
% Create E
E = parallel(Fnew,G,1,1,2,1);
% E now is 1-input, 2-output. The first output is F, and the other is the
% sum of E and F. Check
E
E = From input to output... 1 1: ----- s + 1 2 s + 3 2: ------------- s^2 + 3 s + 2 Continuous-time transfer function.
F
F = 1 ----- s + 1 Continuous-time transfer function.
minreal(G+F)
ans = 2 s + 3 ------------- s^2 + 3 s + 2 Continuous-time transfer function.
% Now put C in series with E
H = series(C,E)
H = From input to output... 1 1: ------- s^2 + s 2 s + 3 2: ----------------- s^3 + 3 s^2 + 2 s Continuous-time transfer function.
% Now close the loop using the second output of H
ClosedLoop = feedback(H,1,1,2,-1)
ClosedLoop = From input to output... s^3 + 3 s^2 + 2 s + 1.089e-16 1: --------------------------------- s^5 + 4 s^4 + 7 s^3 + 7 s^2 + 3 s 2 s + 3 2: --------------------- s^3 + 3 s^2 + 4 s + 3 Continuous-time transfer function.
% Hmm, why are the denominators different?
zpk(ClosedLoop)
ans = From input to output... s (s+2) (s+1) 1: ---------------------------------------- s (s+1.682) (s+1) (s^2 + 1.318s + 1.783) 2 (s+1.5) 2: -------------------------------- (s+1.682) (s^2 + 1.318s + 1.783) Continuous-time zero/pole/gain model.
% Looks like feedback() left some pole/zero cancellations uncancelled.
% This happened because of the lazy way I replicated F.
% It would not have happened if I would have used ss objects throughout,
% which is the preferred approach.
% But we can get rid of them.
ClosedLoop = minreal(ClosedLoop)
ClosedLoop = From input to output... s + 2 1: --------------------- s^3 + 3 s^2 + 4 s + 3 2 s + 3 2: --------------------- s^3 + 3 s^2 + 4 s + 3 Continuous-time transfer function.
% Now we can check each result individually using block diagram algebra
% (not a recommended approach in general)
minreal(F*C/(1+C*(F+G)))
ans = s + 2 --------------------- s^3 + 3 s^2 + 4 s + 3 Continuous-time transfer function.
minreal((G+F)*C/(1+C*(F+G)))
ans = 2 s + 3 --------------------- s^3 + 3 s^2 + 4 s + 3 Continuous-time transfer function.
  3 Comments

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 21 Nov 2021
Create Subsystem, then click the right hand edge to Add Port for as many output ports as you need
Or, instead create your subsystem and add Outport blocks; https://www.mathworks.com/help/simulink/slref/outport.html
  1 Comment
Jun Meng
Jun Meng on 21 Nov 2021
thanks for answering :)
but I'm not building this system in simulink, rather in MATLAB coding.
I want to know how to code this part.
here is what I already have:
E = F + G
closed_loop = (C*E, -1)

Sign in to comment.

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!