I'm studying wave digital filters for my bachelor's thesis and I'm finding problems in implementing a voltage divider to test my knowledge.

Here's the circuit that I'm trying to simulate and the WDF tree that I think it's valid

To simulate the circuit above I created the following matlab code

clear all

t = [0:0.1:10];
f = 10000;
fs = 100000;
n = length(t);

% Resistance of resistors (duh)
Rv = 10e3;
R1 = 10e3;
R2 = 10e3;

% Voltage input
V = sin(2*pi*f/fs*t);

% Initialize arrays
Ac = zeros(1,n);
As2 = zeros(1,n);
Br2 = zeros(1,n);
Ar2 = zeros(1,n);
Bs2 = zeros(1,n);

% Series connector port resistances
Rps1 = Rv;
Rps2 = R1;
Rps3 = R2;

% Series connector port scattering parameters
lps11 = (2*Rps1) / (Rps1 + Rps2 + Rps3);
lps12 = (2*Rps2) / (Rps1 + Rps2 + Rps3);
lps13 = (2*Rps3) / (Rps1 + Rps2 + Rps3);

% Iterates over the whole input wave
for i=2:n
%     Inputs waves to the series connector
    As1 = V(i);
    As2(i) = 0;
    As3(i) = 0;

%     Reflectes waves to the series connector
    Bs1 = As1 - lps11*(As1 + As2(i) + As3(i));
    Bs2(i) = As2(i) - lps11*(As1 + As2(i) + As3(i));
    Bs3(i) = As3(i) - lps11*(As1 + As2(i) + As3(i));

% Calculates output voltages over resistors
Vr1 = (Bs2+As2)/2;
Vr2 = (Bs3+As3)/2;

% Plot outputs

Which gave me the following output

The first plot is the input voltage and the second is the output voltage over one of the resistors

As can be seen the magnitude of the output is the same as expected (1/3 of the input), but the signal is multiplied by -1.

Is there something fundamentally wrong that I'm doing so that even the simplest circuit can't be correctly simulated?


The problem that you are facing is one of polarity. When the 3-port series adaptor is defined in the wave-domain certain polarities are inherently assumed. If I am not mistaken the polarity of the 3-port series adaptor you are using is the following:

enter image description here

The circuit that you have shown has the following explicit polarities (shown in both Kirchoff- and wave-domain).

enter image description here

This miss-match is not a big deal for linear circuits (just invert the output). However, if you move up to nonlinear circuits polarity is crucial to the correctness of the derived algorithm. To remedy issues related to polarity, one needs to be mindful of the polarities at play and act accordingly. For the above circuit you can for example reverse the polarities of the resistors by placing a 2-port series adaptor, also known as an inverter, to invert the polarity so that it is correct with respect to the polarities as you define them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.