Reduce block diagrams symbolically

11 views (last 30 days)
Aleem Andrew
Aleem Andrew on 6 Feb 2021
Answered: Paul on 6 Feb 2021
Can the code below be modified to find the transfer function in terms of symbolic functions g1 to g5 instead of numeric functions? I tried passing symbolic arrays as arguments to tf but I get an error message stating that the values of num and den must be numeric arrays. Is there a way to write code similar to the code below but with g1, g2, g3, g4, and g5 being passed as symbolic arguments?
g1 = tf(1,[1 0 0]);
num2 = 50; den2 = [1 1];
g2 = tf(num2,den2);
g3 = tf(2,[1,0]); g4 = tf([1 0],1);
g5 = tf(2,[1]);
sys1 = parallel(g4,-g5);
sys2 = feedback(g2,g3,-1);
sys4 = series(sys2,sys1);
sys5 = series(sys4,g1);
sys6 = feedback(sys5,[1])
answer = minreal(sys6)

Answers (1)

Paul
Paul on 6 Feb 2021
Assuming you want final result in terms of the gi(s):
syms g1(s) g2(s) g3(s) g4(s) g5(s)
symsys1 = g4(s)-g5(s);
symsys2 = g2(s)/(1 + g3(s)*g2(s));
symsys4 = symsys2*symsys1;
symsys5 = symsys4*g1(s);
symsys6 = symsys5/(1 + symsys5);
symsys6 = simplify(symsys6,50);
[num,den] = numden(symsys6);
symsys6 = num/den;
symsys6
symsys6 =
(g1(s)*g2(s)*g4(s) - g1(s)*g2(s)*g5(s))/(g2(s)*g3(s) + g1(s)*g2(s)*g4(s) - g1(s)*g2(s)*g5(s) + 1)

Categories

Find more on Symbolic Math Toolbox 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!