Matlab Transfer function multiple single s terms

3 views (last 30 days)
How can modify this script in order to get the transfer function shown in the picutre. Thanks.
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
A = 1/(C1*R2);
B = 1/(C2*R2);
C = (1/(C1*R1))*(1-G);
D = 1/(C1*C2*R1*R2);
G = (R3+R4)/R3;
%{
Numerator = {[G 0 0] };
Denominator = {[1 0] [A] [B] [C] [0 D]};
T = tf(Numerator, Denominator)
%}
T = tf([G 0 0], {[1] [A] [B] [C] [0 D]})

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 20 Feb 2023
Here it is:
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
G = (R3+R4)/R3;
A = 1/(C1*R2);
B = 1/(C2*R2);
C = (1/(C1*R1))*(1-G);
D = 1/(C1*C2*R1*R2);
%{
Numerator = {[G 0 0] };
Denominator = {[1 0] [A] [B] [C] [0 D]};
T = tf(Numerator, Denominator)
%}
T = tf([G 0 0], [1 (A+B+C) -D])
T = 21.74 s^2 -------------------------- s^2 - 1.378e07 s - 7.88e09 Continuous-time transfer function.

More Answers (1)

Walter Roberson
Walter Roberson on 20 Feb 2023
syms G C_1 R_2 C_2 R_1 s R_3 R_4
G = (R_3 + R_4)/R_3
G = 
vratio = G*s^2/ ( s^2 + s * (1/(C_1*R_2) + 1/(C_2*R_2) + 1/(C_1*R_1)*(1-G)) + 1/(C_1*C_2*R_1*R_2) )
vratio = 
vex = expand(vratio);
[N, D] = numden(vex)
N = 
D = 
Nc = collect(N, s);
Dc = collect(D, s);
vpretty = Nc/Dc
vpretty = 
NCs = coeffs(Nc, s, 'all')
NCs = 
DCs = coeffs(Dc, s, 'all')
DCs = 
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
NC = double(subs(NCs, [C_1, C_2, R_1, R_2, R_3, R_4], [C1, C2, R1, R2, R3, R4]));
DC = double(subs(DCs, [C_1, C_2, R_1, R_2, R_3, R_4], [C1, C2, R1, R2, R3, R4]));
leading = DC(1);
NC = NC ./ leading;
DC = DC ./ leading;
sys = tf(NC, DC)
sys = 21.74 s^2 -------------------------- s^2 - 1.378e07 s + 7.88e09 Continuous-time transfer function.
  2 Comments
Walter Roberson
Walter Roberson on 21 Feb 2023
Note that the reason to solve symbolically is to construct a general form that multiple sets of resister and capacitor values could be substituted into. After calculating NCs and DCs you could use matlabFunction() to create functions that would accept numeric inputs and calculate the coefficients.
Paul
Paul on 22 Feb 2023
But the CST can handle this directly without too much complication, even if the desire is to have a general expression
s = tf('s');
G = @(R_3,R_4) ((R_3 + R_4)/R_3);
vratio = @(C_1,C_2,R_1,R_2,R_3,R_4) G(R_3,R_4)*s^2/ ( s^2 + s * (1/(C_1*R_2) + 1/(C_2*R_2) + 1/(C_1*R_1)*(1-G(R_3,R_4))) + 1/(C_1*C_2*R_1*R_2) );
C1 = 0.000000000150;
C2 = 0.000000000470;
R1 = 10000;
R2 = 180000;
R3 = 2700;
R4 = 56000;
vratio(C1,C2,R1,R2,R3,R4)
ans = 21.74 s^2 -------------------------- s^2 - 1.378e07 s + 7.88e09 Continuous-time transfer function.
Unrelated comment, but I have my suspicions about the expression for vratio in the question. I thought that circuits composed of just (positive) resistors and (positive) capacitors can't be unstable, whereas vratio clearly is.

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!