SIGNAL FLOW GRAPH

Signal flow graph

We'll follow certain rules when we build up a network flow graph.

 

  1. Each variable tex2html_wrap_inline2875 and tex2html_wrap_inline2877 will be designated as a node.
  2. Each of the S-parameter will be a branch.
  3. Branches enter dependent variable nodes and emanate from the independent variable nodes.
  4. Each node is equal to sum of the branches entering it.

 

 figure339
Figure 10: Complete Flow graph for 2-port
 

Flow graph of a source

A generator with an internal voltage source and an internal impedance will have a wave emanating from it. We define a new term, tex2html_wrap_inline2879, for the wave emanating from the source. Where
equation345
Note that tex2html_wrap_inline2879 is the square root of the power transmitted to the transmission line.

 

 figure349
Figure 11: Flow graph for a generator
 

tex2html_wrap_inline2883 is the reflection coefficient of the source
 

Flow graph of a load

For a load, the flow graph is simply, tex2html_wrap_inline2885, the reflection coefficient of the load.

 

 figure355
Figure 12: Flow graph for a load
 

Flow graph of a 2-port network with source and load

To demonstrate the utility of flow graphs. Let's embed a two-port network between a source and a load.

 

 figure361
Figure 13Flow graph for a two-port network with a source and a load
 

Mason's rule

We can use Mason's rule to solve for the relationship between of any two nodes in the network.

Let T be the transfer ratio between two nodes
equation367
 

 

 
where 		 tex2html_wrap_inline2889, tex2html_wrap_inline2891, ... are the various paths connecting the nodes,

tex2html_wrap_inline2893 is a first order loop,

tex2html_wrap_inline2895 is a second order loop,

tex2html_wrap_inline2897 is a first order loop that does not touch path tex2html_wrap_inline2889,

tex2html_wrap_inline2901 is a second order loop that does not touch path tex2html_wrap_inline2889.

 

A first order loop is defined as the product of the branches encounter starting from a node and moving in the direction of the arrows back to its origin.

A second order loop is the product of two non-touching first order loops.

Example 1 We want to find the ratio tex2html_wrap_inline2905.
eqnarray384
 

eqnarray399
 

Similarly, we can also find
eqnarray424
 

Example 2 We want to find the power delivered from a source to a load as shown in Figure 14. The power delivered is

 

 figure455
Figure 14Flow graph for a load connected to a source
 

 

eqnarray460
 

If the load is conjugately matched to the source, i.e., tex2html_wrap_inline2907, P becomes the available power from the source
equation469
 

 

COURTESY:eie.polyu.edu

Signal Flow Graph

One possible signal flow graph (or system diagram) for Eq.$ \,$(5.1) is given in Fig.5.1a for the case of $ M = 2$ and $ N = 2$. Hopefully, it is easy to see how this diagram represents the difference equation (a box labeled ``$ z^{-1}$'' denotes a one-sample delay in time). The diagram remains true if it is converted to the frequency domain by replacing all time-domain signals by their respective z transforms (or Fourier transforms); that is, we may replace $ x(n)$ by $ X(z)$ and $ y(n)$ by $ Y(z)$.

 

Figure 5.1: Signal flow graph for the filter difference equation

$ y(n) = b_0 x(n) + b_1 x(n - 1) + b_2 x(n - 2) - a_1 y(n - 1) - a_2 y(n - 2)$.

(a) Direct form I. (b) Direct form II.

\begin{figure}\input fig/kfig2p8.pstex_t<br />
            \end{figure}

 

Signal Flow Graph

Figure 3.1 shows the signal flow graph (or system diagram) for the class of digital filters we are consideringThe symbol ``$ z^{-M}$'' means a delay of $ M$ samples (always an integer here).

 

Figure 3.1: signal flow graph for digital filters having difference equations of the form

$ y(n) = x(n) + g_1\, x(n-M_1) - g_2\, y(n-M_2)$ (digital comb filters).

\begin{figure}\input fig/esd.pstex_t<br />
            \end{figure}

Software Implementation in Matlab

In matlab or octave this type of filter can be implemented using the filter function. For example, the following matlab code computes the output signal y given the input signal x for a specific example comb filter:

 

g1 = (0.5)^3;        % Some specific coefficients
g2 = (0.9)^5;
B = [1 0 0 g1];      % Feedforward coefficients, M1=3
A = [1 0 0 0 0 g2];  % Feedback coefficients, M2=5
N = 1000;            % Number of signal samples
x = rand(N,1);       % Random test input signal
y = filter(B,A,x);   % Matlab and octave compatible

The example coefficients,

$ g1 = 0.5^3 = 0.125$ and

$ g2 = 0.9^5 =<br />
0.59049$, are chosen to place all filter zeros at radius $ 0.5$ and all filter poles at radius $ 0.9$ in the complex $ z$ plane (as we shall see below).

The matlab filter function carries out the following computation for each element of the y array:
 

$\displaystyle \texttt{y(n)}$ $\displaystyle =$ $\displaystyle \sum_{\texttt{k=0}}^\texttt{NB-1} \texttt{B(k+1) * x(n-k)}$ (4.2)
  $\displaystyle -$ $\displaystyle \sum_{\texttt{k=1}}^\texttt{NA-1} \texttt{A(k+1) * y(n-k)}<br />
            \protect$ (4.3)



for

$ \texttt{n}=1,2,\dots,\texttt{N}$, where NA = length(A) and NB = length(B). Note that the indices of x and y can go negative in this expression. By default, such terms are replaced by zero. However, the filter function has an optional fourth argument for specifying the initial state of the filter, which includes past input and past output samples seen by the filter. This argument is used to forward the filter's state across successive blocks of data:

[y1,state] = filter(B,A,x1);       % filter 1st block x1
[y2,state] = filter(B,A,x2,state); % filter 2nd block x2
...

 

 

Sample-Level Implementation in Matlab

For completeness, a direct matlab implementation of the built-in filterfunction (Eq.$ \,$(3.3)) is given in Fig.3.2. While this code is useful for study, it is far slower than the built-in filter function. As a specific example, filtering $ 10,000$ samples of data using an order 100 filter on a 900MHz Athlon PC required 0.01 seconds for filter and 10.4 seconds for filterslow. Thus, filter was over a thousand times faster than filterslow in this case. The complete test is given in the following matlab listing:

x = rand(10000,1); % random input signal
B = rand(101,1);   % random coefficients
A = [1;0.001*rand(100,1)]; % random but probably stable
tic; yf=filter(B,A,x); ft=toc
tic; yfs=filterslow(B,A,x); fst=toc

The execution times differ greatly for two reasons:

  1. recursive feedback cannot be ``vectorized'' in general, and
  2. built-in functions such as filter are written in C, precompiled, and linked with the main program.

 

Figure 3.2: Matlab function for implementing a digital filterdirectly. Do not use this in practice because it is much slower than the built-in filter routine.

 

function [y] = filterslow(B,A,x) 
% FILTERSLOW: Filter x to produce y = (B/A) x .
%       Equivalent to 'y = filter(B,A,x)' using 
%       a slow (but tutorial) method.

NB = length(B);
NA = length(A);
Nx = length(x);

xv = x(:); % ensure column vector

% do the FIR part using vector processing:
v = B(1)*xv;
if NB>1
  for i=2:min(NB,Nx)
    xdelayed = [zeros(i-1,1); xv(1:Nx-i+1)];
    v = v + B(i)*xdelayed;
  end; 
end; % fir part done, sitting in v

% The feedback part is intrinsically scalar,
% so this loop is where we spend a lot of time.
y = zeros(length(x),1); % pre-allocate y
ac = - A(2:NA); 
for i=1:Nx, % loop over input samples
  t=v(i);   % initialize accumulator
  if NA>1, 
    for j=1:NA-1
      if i>j, 
        t=t+ac(j)*y(i-j); 
      %else y(i-j) = 0
      end; 
    end; 
  end; 
  y(i)=t; 
end; 

y = reshape(y,size(x)); % in case x was a row vector

 courtesy:ccrma.stanford.edu


Dear Guest,
Spend a minute to Register in a few simple steps, for complete access to the Social Learning Platform with Community Learning Features and Learning Resources.
If you are part of the Learning Community already, Login now!
0
Your rating: None

Posted by



Wed, 05/20/2009 - 10:15

Share

Collaborate