Lecture 12
- 格式:pdf
- 大小:142.21 KB
- 文档页数:3
Digital Signal ProcessingLecture12Block Diagram and Signal Flow Graph Representationof LTI SystemsTesheng Hsiao,Associate ProfessorSuppose that the input and output of a causal LTI system satisfy the following linear constant-coefficient equationy[n]−N∑k=1a k y[n−k]=M∑k=0b k x[n−k](1)The input and output relation can be expressed by the convolution sum or the system functiony[n]=∞∑k=0h[k]x[n−k](2)Y(z)=H(z)X(z)(3)whereH(z)=∑Mk=0b k z−k 1−∑Nk=1a k z−kAlthough all these representations are theoretically equivalent,they result in different computational effects when they are implemented by digital computers or circuits.In this lecture,we will introduce several representations of Eq.(1),each of which has its own com-putational characteristics.1Block Diagram Representation of LTI SystemsThree basic operations are required to implement Eq.(1):addition,multiplication(by a constant coefficient),and(one-step)delay.The following example illustrates these operations and pictorial expressions.Example1Consider the systemy[n]=a1y[n−1]+a2y[n−2]+b0x[n]The corresponding system function isH(z)=b01−a1z−a2zThe block diagram of this system is shown in Fig.(1).The addition,multiplication,and delay are represented by different symbols.Figure 1:Block diagram of the system in Example 1Consider the general case,i.e.the system described by Eq.(1).The block diagram is shown in Fig.(2).This realization is called direct form I .In direct form I realization,the output is obtained through two steps:v [n ]=M ∑k =0b k x [n −k ]y [n ]=N ∑k =1a k y [n −k ]+v [n ]or equivalently,V (z )=H ma (z )X (z )={M ∑k =0b k z −k }X (z )Y (z )=H ar (z )V (z )={11−∑N k =1a k z −k }V (z )and H (z )=H ar (z )H ma (z ).Figure 2:Direct Form I representation of an LTI systemSince both H ar(z)and H ma(z)are LIT systems.We can exchange the order and leave the results unaltered.Hence the system can be implemented in a different way:W(z)=H ar(z)X(z)Y(z)=H ma(z)W(z)or equivalently,w[n]=N∑k=1a k w[n−k]+x[n]y[n]=M∑k=0b k w[n−k]This results in the block diagram in Fig.(3).Figure3:Direct Form II representation of an LTI system In Fig.(3),the two columns of delays contains the same values(w[n−k]);hence they can be combined into one column of delays as shown in Fig.(4).The realization in Fig.(4) is called direct form II or canonic direct form.One distinct property of direct form I and II is the number of delays.In other words, the required size of storage space(memory or register)is different.Direct form I contains N+M delays whereas direct form II has max{M,N}delays.Hence direct form II is more efficient in terms of space usage.An implementation with the minimum number of delay elements is commonly referred to as a canonic form implementation.Example2Consider the LTI systemH(z)=1+2z−11−1.5z−1+0.9z−2The direct form I and II implementation are shown in Fig.(5)and Fig.(6)respectively.Figure4:Direct Form II representation of an LTI systemFigure5:Direct form I of Example22Signal Flow Graph Representation of LTI Systems Instead of using block diagrams introduced in the previous section,we usually use signal flow graph to represent a system described by Eq.(1)because signalflow graphs are more compact.A signalflow graph consists of nodes and directed branches.A node denotes a variable or a sequence.A node could have several entering and leaving branches.A branch connects a pair of nodes with an arrow denoting the direction.Each branch represents a linear operation,such as multiplication or delay,on the departure node.The operation carried out by each branch is denoted by that branch.It denotes the unity gain multiplication if there is no notation associated with the branch.The value of a node is the sum of all entering branches.There are two special nodes in the signalflow graph.Source nodes are nodes that have no entering branches.Source nodes are used to represent the injection of external inputs or signal sources into the graph.Sink nodes are nodes that have only entering branches.Sink nodes are used to extract outputs from the graph.Figure6:Direct form II of Example2Fig.(7)illustrates the direct form II and signalflow graph of afirst order IIR system. The equations represented by Fig.(7b)arew1[n]=aw4[n]+x[n]w2[n]=w1[n]w3[n]=b0w2[n]+b1w4[n]w4[n]=w2[n−1]y[n]=w3[n]These equations can be rearranged,eliminating redundant variables,and becomew2[n]=aw2[n−1]+x[n]y[n]=b0w2[n]+b1w2[n−1]which are exactly the equations represented by direct form II.Figure7:(a)Direct form II(b)Signal Flow GraphOn the other hand,given a signalflow graph,we want to derive the system function from it.The z-transform techniques would be useful in this case,as explained by the following example.Example3Given the signalflow graph in Fig.(8).We can write down the equations for each node:w1[n]=w4[n]−x[n]w2[n]=αw1[n]w3[n]=w2[n]+x[n]w4[n]=w3[n−1]y[n]=w2[n]+w4[n]Take z-transform on both sides,we haveW1(z)=W4(z)−X(z)W2(z)=αW1(z)W3(z)=W2(z)+X(z)W4(z)=z−1W3(z)Y(z)=W2(z)+W4(z)Eliminate W1(z)and W3(z),we obtainW2(z)=α(W4(z)−X(z))(4)W4(z)=z−1(W2(z)+X(z))(5)Y(z)=W2(z)+W4(z)Solving Eq.(4)and Eq.(5)simultaneously,we haveW2(z)=α(z−1−1)1−αz−1X(z)W4(z)=z−1(1−α)1−αz−1X(z)Therefore the system function isY(z)=(α(z−1−1)+z−1(1−α)1−αz−1)X(z)=(z−1−α1−αz−1)X(z)Note that the direct form I representation of the system function is shown in Fig.(9).In direct form I representation,2delay elements and two multiplications are required.Direct form II representation needs one delay element but still two multiplications.In the represen-tation of Fig.(8),only one delay element and one multiplication is required.Figure8:Signalflow graph for Example3Figure9:Direct Form I representation of the system function in Example3。
CS500:Fundamentals of Algorithm Design and Analysis Spring2012
Lecture12—Feb13,2012
Prof.Will Evans Scribe:Shuang Yu In this lecture we:
•Discussed string matching using Finite State Machine;
•Discussed string matching using Knuth-Morris-Pratt Finite State Machine.
1String Matching using Finite State Machine
1.1Problem Statement:
Input:
Pattern P=p1p2...p m
Text T=t1t2...t n
From alphabet=Q,t i∈Q for all i,p j∈Q for all j,n>>m.
Find:
index offirst occurrence of P in T.
1.2Finite State Machine(FSM):
Design a machine that scans text from left to right,and stops if it sees the pattern.
Example:
P=ABAC,Q={A,B,C,D}
Rules:
Create transition:
for each proper prefix R of pattern P
and each charactre x∈Q
where S is the longest prefix of P that is also a suffix of Rx
Running time:
•O(n)once FSM is built[machine takes constant time to consume one text character and
make its transition]
•time to construct FSM≥|Q|·m[because there are this many transitions](there is a
way to construct FSM in O(|Q|·m)time)
•Total time:O(n+|Q|·m)
2Knuth-Morris-Pratt Finite State Machine(KMP-FSM)
Idea:Have a simple”failure”arrow for each state
Example for P=ABAC:
If fail to match the next character in text then follow failure arrow but do not move pointer in text(rescan next text character)unless fail inφ-state.
Text T=A B D A A B A D A B A C
State0120112301234
001
where state0isφ-state,state1is state A,state2is state AB,etc.
Running time:
•#of forward arrows(success)traversed+#of back arrows(failure)traversed≤2n
•Because we know:#of forward arrows traversed≤n(each consumes text character)
#of forward arrows traversed≥#of back arrows traversed
Build KMP-FSM:
1.Make”backbone”(all forward edges)
pute back edges
S is the longest prefix of P that is also a proper(i.e.not R itself)suffix of R
Define:
back[i]is the longest j such that p1p2...p j is a proper suffix of p1p2...p i
back[i]is destination of back edge from state i
state0is initial state
Back calculation:
back[1]=0
j=0
for i=2to m do
while j>0and p j+1=p i do
j=back[j]
if p j+1=p i then j=j+1
back[i]=j
Idea:
Add back edges to states in left to right order,use what has been constructed to
find next back edge quickly.。