#!/usr/bin/env octave

%
%   o--------------
%   Ue    |       |
%        | | R1  | | R2
%        | |     | |
%         |       |
%         |       ------------------------o Ua
%         |       |
%         |       --------o (to Ua2) Ua1
%         |       |
%         |      --- C2
%         |      ---
%         |       |
%         ----------------o (to GND) Ua2
%             |
%            --- C1
%            ---
%             |
%   o-------------------------------------o
%

R1 = 100;	% ohm
R2 = 100;	% ohm
C1 = 0.001;	% farad
C2 = 0.001;	% farad

% adjust
C1 = C1*2*pi;
C2 = C2*2*pi;

% usefull definitions
T1 = R1*C1;	% sec
T2 = R2*C2;	% sec
TT = T1*T2;	% sec^2

den = [TT T1+T2+R1*C2 1];

% G = Ua/Ue = (Ua1+Ua2)/Ue = Ua1/Ue + Ua2/Ue = G1 + G2
G1 = tf([T1 0], den);
figure; bode(G1, 0.1:0.1:1000);

G2 = tf([R1*C2+T2 1], den);
figure; bode(G2, 0.1:0.1:1000);

%G = G1 + G2;	% + not implemented, we do it by hand
G = tf([T1+T2+R1*C2 1], den);
figure; bode(G, 0.1:0.1:1000);

pause;
