symbolic analysis and design of communication systems using computer algebra systems
Post on 13-Feb-2016
52 Views
Preview:
DESCRIPTION
TRANSCRIPT
Symbolic analysis and design of communication systems using
computer algebra systems
Prof. Dr Miroslav Lutovac Dr Dejan Tošić
School of Electrical Engineering at the University of Belgrade, Serbia
Overview
• Get back to basic understanding• Numeric vs. Symbolic Computation• Computer as a symbol processor• Schematic as a symbolic object• Programs as knowledge repositories• A step by step example: QAM• Benefits from symbolic techniques
James Kaiser - 50 years of SP
It has become so easy to do so much computation using computers that people will press keys on the keyboard without thinking what they are doing
It's so easy to generate a tremendous amount of garbage that you've got to understand what it is you're doing
Fifty Years of SP (1998), page 54
James Kaiser: “back to basics”
So it is very important that we get back to basic understanding, get a much better grounding of what science underlies the phenomenon we are looking at
I mean, this world is not an ideal world It's time-varying and nonlinear
Fifty Years of SP (1998), page 54
James Kaiser: “understand tools”
Young people or anybody, really who are using these tools have got to thoroughly understand what assumptions underlie the tool that they are using
That will tell them what they can expect to get out
Fifty Years of SP (1998), page 54
Numerical ambiguity: 0.3 - 0.1 == 0.2?
>> a = 0.3-0.1a = 0.2000>> b = 0.2b = 0.2000>> a==bans = 0 0.3 – 0.1 ≠ 0.2
MATLAB Command Window
Why is 0.3-0.1 ≠ 0.2 ?
>> sym(0.8-0.6,'d')ans = .20000000000000006661338147750939>> sym(0.2,'d')ans = .20000000000000001110223024625157>> sym(0.3-0.1,'d')ans = .19999999999999998334665463062265>> sym(0.6-0.4,'d')ans = .19999999999999995559107901499374
MATLAB Command Window
Numeric vs. Symbolic Computation
>> (2/10)==(1-8/10)ans = 0
>> sym(2/10)==sym(1-8/10)ans = 1
>> a=1; a=a-0.2; a=a-0.2; a=a-0.2; a=a-0.2; a=a-0.2a = 5.5511e-017
a ≈ 0, a ≠ 0
Numeric is false
Symbolic is true
Numeric simulation might fail
Symbolic computation finds exact solution
Algebraic loop• Symbolic analysis of systems is
inherently immune to the problem imposed by algebraic loops occurring when two or more blocks with direct feed-through of their inputs form a feedback loop
• Numeric simulations of algebraic loops considerably reduce the speed of a simulation and may be unsolvable
• Symbolic simulation successfully and accurately computes the required response;it finds the exact solution
Computer as a symbol processor
• Computers have become recognized as symbol processors (Oppenheim and Nawab 1992)
• Program can be viewed as a set of instructions for manipulating symbols
• Numbers are only one of the kinds of symbols that the computer can handle
Schematic as a symbolic object System model is a symbolic object It contains all details for drawing, symbolic
solving, simulating, and implementing:1. Analyze the schematic as the symbolic object2. Identify symbolic system parameters3. Knowledge embedded in
the schematic object can be used to generate implementation code or to derive transfer function
From schematic to system property
system = { {"Multiplier", {{6, 0}, {6, 3}}, k1}, {"Delay", {{4, 5}, {4, 7}}, 1}, {"Adder",{{7,8},{8,5},{9,8},{8,9}},{1,1,2,0}}, {"Input", {0, 8}, "X"}, {"Output", {9, 8}, "Y1L"},..., {"Line", {{6, 8}, {7, 8}}} }
k1
k1
k0
b
z1
z1
z1
k2
k2
b
z1
z1
b
z1
z1
z1 z1
k3
k3
b
z1
z1
b
z1
z1
z1 z1
XY1L
Y1H
Y2L
Y2H
Y3L
Y3H
1. Find transfer function
2. Simplify expression
s = H1*(H1/. z->1/z) + H2*(H2/. z->1/z) //FullSimplify
Computer as intelligence amplifier
• Symbol processor with the appropriate programs is usable on a much wider range of tasks, such as intelligence amplifier or augmenting our ability to think
• Programming has become a task of knowledge accumulation telling the computer what to know, when to use, and how to apply the knowledge in solving problems
What to know - How to apply WHAT TO KNOW: symbolic object that contains
a procedure for automated generation of the schematic for an arbitrary number of parts
HOW TO APPLY: draw system, solve symbolically, simulate, and implement system
1. Automatically generate system parameters2. Automatically generate schematic
with symbolic or numeric parameters3. Solve symbolically: find the transfer function, impulse
response, or property of the system from the schematic4. Automatically generate implementation code5. Simulate for specified symbolic parameter values
What to know - When to use WHAT TO KNOW: symbolic object that contains
a procedure for automated generation of the schematic for an arbitrary number of parts
WHEN TO USE: 1. When Laplace or z-transform cannot be found2. When numeric computations fail3. When symbolic expressions have a
large number of parameters4. When derivation by hand is
very time consuming and difficult5. When symbolic optimization can reduce the
number of parameters used in numeric optimization
Knowledge repositories
• Programs are viewed as knowledge repositories
• Programs should be written to communicate …
• … not simply to compute
0 2 4 6 8 10 12 14 16 18 20 22 24
01234567891011
aK
z1
z1
Programs as knowledge repositories1. draw basic part of system
0 2 4 6 8 10 12 14 16 18 20 22 24
01234567891011
a0
X
z1
0 2 4 6 8 10 12 14 16 18 20 22 24
01234567891011
Xd
m
YeYf
2. draw input
3. draw output
(* generate schematic by replicating the basic part *)numberOfStages = 7;adaptiveSystem = TranslateSchematic[...adaptiveSystem = Join[adaptiveSystem, ...Do[adaptiveSystem = Join[adaptiveSystem,... aK -> ToExpression["a"~StringJoin~ ... {k, numberOfStages}];
4. write code
5. Save as function, add knowledge of a system
{schematicSpec, inps, outs} = SchematicFunction[params, …{x0, y0}, options]
Automated drawing of systemsnumStages = 3
p = UnitSymbolicSequence[numStages + 1, k, 0]
parameterSymbols = Join[{b}, p] // Flatten
{hsSystem, inpCoordsHS, outCoordsHS} = HighSpeedIIR3FIRHalfbandFilterSchematic[parameterSymbols];
ShowSchematic[hsSystem]
k1
k1
k0
b
z1
z1
z1
k2
k2
b
z1
z1
b
z1
z1
z1 z1
k3
k3
b
z1
z1
b
z1
z1
z1 z1
XY1L
Y1H
Y2L
Y2H
Y3L
Y3H
Invoke from the knowledge repository
Programs written to communicate
k1
k1
k0
b
z1
z1
z1
k2
k2
b
z1
z1
b
z1
z1
z1 z1
k3
k3
b
z1
z1
b
z1
z1
z1 z1
XY1L
Y1H
Y2L
Y2H
Y3L
Y3H
system = { {"Multiplier",{{6,0},{6,3}},k1}, {"Delay",{{4,5},{4,7}},1}, {"Adder",{{7,8},...,{1,1,2,0}}, {"Input",{0,8},"X"},..., {"Line",{{6,8},{7,8}}}}
Out[76]= k2 1 k1 k3 k1 k31 k11 k3 k3
k1
k1
k0
b
z1
z1
z1
k2
k2
b
z1
z1
b
z1
z1
z1 z1
k3
k3
b
z1
z1
b
z1
z1
z1 z1
XY1L
Y1H
Y2L
Y2H
Y3L
Y3H
Solve: find transfer function of all outputs {Y3L/X, Y3H/X}
1z5b z25 k0b5 b4 k1z5 b4 z2 b3 k1k2z2 b3k2k3z2 4 b3 k1z3 b5k1z3 b2k2z3 b2 k1k2k3z3 10 b3z4 3 b2 k1k2z4
2 b4k1k2z4 bk1k3z4 3b2 k2k3z4 2 b4k2k3z4 6 b2k1z5 4 b4 k1z5 2 bk2z5 3b3k2z5 k3z5 2 bk1k2k3z53 b3k1k2k3z5 10 b2 z6 3 bk1k2z6 6 b3k1k2z6 b5k1k2z6 k1k3z6 4 b2 k1k3z6 3 bk2k3z6 6b3 k2k3z6b5k2k3z6 4 bk1z7 6 b3 k1z7 k2z7 6 b2 k2z7 3 b4k2z7 5bk3z7 k1k2k3z7 6 b2k1k2k3z7 3 b4 k1k2k3z75 bz8 k1k2z8 6 b2k1k2z8 3b4 k1k2z8 4 bk1k3z8 6 b3 k1k3z8 k2k3z8 6 b2k2k3z8 3 b4k2k3z8 k1z94 b2k1z9 3 bk2z9 6b3 k2z9 b5k2z9 10 b2k3z9 3 bk1k2k3z9 6b3 k1k2k3z9 b5k1k2k3z9 z10 2 bk1k2z103 b3k1k2z10 6 b2 k1k3z10 4 b4k1k3z10 2 bk2k3z10 3 b3k2k3z10 bk1z11 3 b2 k2z11 2b4k2z11 10 b3k3z113 b2k1k2k3z11 2b4 k1k2k3z11 b2k1k2z12 4 b3 k1k3z12 b5 k1k3z12 b2k2k3z12 b3 k2z13 5 b4k3z13 b3k1k2k3z13 b4 k1k3z14 b5k3z15
Proving the property of the system
1)/1()()/1()( 2211 zHzHzHzH
s = H1*(H1/. z->1/z) + H2*(H2/. z->1/z) //FullSimplify
1z5b z25 k0b5 b4 k1z5 b4 z2 b3 k1k2z2 b3k2k3z2 4 b3 k1z3 b5k1z3 b2k2z3 b2 k1k2k3z3 10 b3z4 3 b2 k1k2z4
2 b4k1k2z4 bk1k3z4 3b2 k2k3z4 2 b4k2k3z4 6 b2k1z5 4 b4 k1z5 2 bk2z5 3b3k2z5 k3z5 2 bk1k2k3z53 b3k1k2k3z5 10 b2 z6 3 bk1k2z6 6 b3k1k2z6 b5k1k2z6 k1k3z6 4 b2 k1k3z6 3 bk2k3z6 6b3 k2k3z6b5k2k3z6 4 bk1z7 6 b3 k1z7 k2z7 6 b2 k2z7 3 b4k2z7 5bk3z7 k1k2k3z7 6 b2k1k2k3z7 3 b4 k1k2k3z75 bz8 k1k2z8 6 b2k1k2z8 3b4 k1k2z8 4 bk1k3z8 6 b3 k1k3z8 k2k3z8 6 b2k2k3z8 3 b4k2k3z8 k1z94 b2k1z9 3 bk2z9 6 b3 k2z9 b5k2z9 10 b2k3z9 3 bk1k2k3z9 6b3 k1k2k3z9 b5k1k2k3z9 z10 2 bk1k2z103 b3k1k2z10 6 b2 k1k3z10 4 b4k1k3z10 2 bk2k3z10 3 b3k2k3z10 bk1z11 3 b2 k2z11 2b4k2z11 10 b3k3z113 b2k1k2k3z11 2b4 k1k2k3z11 b2k1k2z12 4 b3 k1k3z12 b5 k1k3z12 b2k2k3z12 b3 k2z13 5 b4k3z13 b3k1k2k3z13 b4 k1k3z14 b5k3z15
Deriving new propertys = H1*(H1/. z->1/z) + H2*(H2/. z->1/z) //FullSimplify
Solve[s == 1, k0]
Out[57]= k0 121 k121 k221 k32
num3 = Numerator[h3L//Together]/. z -> -1Solve[num3==0, k2]
Out[76]= k2 1 k1 k3 k1 k31 k11 k3 k3
Deriving design equations
Out[57]= k0 121 k121 k221 k32
Out[76]= k2 1 k1 k3 k1 k31 k11 k3 k3
K50 121 K5121 K5221 K532
K52 1 K51 K53 K51 K531 K51 K53 K51 K53
Generating implementation code
DiscreteSystemImplementation[hsSystem,"hsf"]
{{Y9p8, Y9p0, Y31p0}, {Y4p5, Y4p3, Y2p8}} =
hsf[{Y0p8},{Y4p7, Y4p5, Y28p0},{b, k0, k1, k2, k3}] is the template for calling the procedure.
The general template is {outputSamples, finalConditions} = procedureName[inputSamples, initialConditions, systemParameters]. See also: DiscreteSystemImplementationProcessing
1. Output variables
2. Input variables
3. System parameters4. Usage
Get information about implementation procedure
??implementationProcedure
implementationProcedure[dataSamples_List,initialConditions_List,systemParameters_List] :=
Module[{Y0p10,Y4p9,Y4p3,a2,a3,b1,b2,b3},{a2,a3,b1,b2,b3}=systemParameters;{Y0p10}=dataSamples;{Y4p9,Y4p3}=initialConditions;
Y3p0=b3 Y0p10;Y3p4=b2 Y0p10;Y3p10=b1 Y0p10;Y4p5=Y3p4+Y4p3;Y8p10=Y3p10+Y4p9;Y5p0=a3 Y8p10;Y5p6=a2 Y8p10;Y4p1=Y3p0-Y5p0;Y4p7=Y4p5-Y5p6;{{Y8p10},{Y4p7,Y4p1}}]
1. Variables
2. Input variables
3. Initial conditions4. Code
2. Transfer function
3. Time response
1. Symbolic parameter
Transferfunction matrix
of MIMO system
Simulation with
symbolic system
parameters
Transfer function
Symbolic simulation
Symbolic processingnumberInSamples = 20;
inputSequence = UnitImpulseSequence[numberInSamples];
eqns = DiscreteSystemImplementationEquations[hsSystem];initialConditions = 0*eqns[[2]]systemParameters = eqns[[3]]
{outputSeq, finalCond}=DiscreteSystemImplementationProcessing[inputSequence, initialConditions, systemParameters, hsf];
Out[85]=
b51 b2k0b7 9 b2k2 k156 b7 k2 k3 b280 b220 b2 b2 9 k2 k3Each element
of the output sequence is a symbolic expression
Response in time domain
p={b→9/16,k0→0.24000685,k1→2.37428,k2→-0.54068,k3→0.1093268}
y=InverseZTransform[hsSystem /. p, z, n]
Use z-transform (if it exists)
How to synthesize a discrete system?
1. For known transfer function H(z) = ( 1 + 2 z -1 + z -2 ) / ( 1 + ½ z -2 )
create schematic of the system {schematic, {inpCoord}, {outCoord}} =TransposedDirectForm2IIRFilterSchematic[{{1,2,1},{0,1/2}}];
2. Add input element and output elementsystem = Join[schematic,{{"Input",inpCoord,X}, {"Output",outCoord,Y}}]
3. Draw the block-diagramShowSchematic[system]
Invoke from the knowledge repository
Discrete systems analysis:Find response from the schematic
4. Compute transfer function from the schematic{tfMatrix, systemInp, systemOut} = DiscreteSystemTransferFunction[system];tf = tfMatrix[[1, 1]];
5. Input signal represented by a formulasineSignal = Sin[n/5];
6. Find output signalsineTransform = ZTransform[sineSignal, n, z];response = InverseZTransform[sineTransform*tf,z,n]
8 Cos11022n2 Cosn
2Sin1
5 2 Sin1n
5 Sin1n
5 2 1
2 n2Sin1
5 4 Sin2
5Sinn
2
5 4 Cos25
Discrete systems analysisusing symbolic processing
1. Generate a code that implements the systemDiscreteSystemImplementation[system, "imp"];
2. Compute input sequence whose elements can be symbols, numbers, or formulasinSeq = UnitSineSequence[8, 1/(10 π), 0];
3. Process the input sequence with the code{outSeq,finals} = DiscreteSystemImplementationProcessing[inSeq,{0,0},{},imp];
142 Sin1
5 Sin2
5 4 Sin3
5 2 Sin4
5 8 Sin1 Sin6
5
The seventh element of the output sequence
is not a number; it is an expression
Comparing multirate realizations
outClassic
outSeq
In[88]:=SameQoutClassic, outSeq
Out[88]=True
Quadrature Amplitude Modulation
A step by step example
What is QAM?
• Quadrature Amplitude Modulation (QAM) is a widely used method for transmitting digital data over bandpass channels
• The simulation of a simplified and idealized QAM system follows
Read-in the knowledge
Generate the transmitter part
Generate the demodulator part
Generate the filter part
Generate the complete system
Generate the implementation code
Generate the input sequences
20 40 60 80 100
-1
-0.5
0.5
1
Process the input sequences with the
system
Simulate the input sequences with the
system
Miscellaneous examples
Hilbert Transformer
Hilbert Transformer in QAM
Input and Output Sequences
0.002 0.004 0.006 0.008 0.01 0.012Times
-1
-0.5
0.5
1
0.002 0.004 0.006 0.008 0.01 0.012Times
-1
-0.5
0.5
1
Better output with Hilbert transformer
20 40 60 80 100
-0.6
-0.4
-0.2
0.2
0.4
0.6
Classic filter produces this
-4000 -2000 0 2000 4000Frequency Hz0
0.1
0.2
0.3
0.4
0.5
murtcepS
Output of modulatorSystem
-4000 -2000 0 2000 4000Frequency Hz0
0.2
0.4
0.6
0.8
1
murtcepS
Input to modulatorSystem
-4000 -2000 0 2000 4000Frequency Hz0
0.2
0.4
0.6
0.8
murtcepS
Output of modulatorSystem
Spectra of QAM Signals
Complex signal
Modulated signal
Input signal
Amplitude Modulation
Nonlinear systems
Can we find the output signal as a closed-form expression in terms of the sample index?
Nonlinear systems: Symbolic response
1. Draw the schematic2. Automatically generate a code that implements the system
DiscreteSystemImplementation[system, "implement"];3. Compute the successive output values
{{y2}, {d2}} = implement[{1,10}, {d1}, {}];{{y3}, {d3}} = implement[{1,10}, {d2}, {}];
4. Eliminate the initial states and find the relation between the output sampleseqns = Reduce[{y[n-1]==y2, y[n]==y3}, {d1}];
5. Find the recurrence equationreducedEqn =(15 y[-1 + n] == -10 + 16 y[n]);
6. Load knowledge for solving recurrence equations<<DiscreteMath`RSolve`
7. Find a closed-form solutionRSolve[{reducedEqn,y[0]==0},y[n],n];yn 101 15
16n
Nonlinear systems: Optimization
• Example: find the number of samples after which the output sequence reaches some value, say b
• Solve[y[n] == 10*b, n];• Solution:
• Verification:
n Log1 bLog16
15
Adaptive System
Finding Adapted Coefficients
Symbolic Response of the Unknown System
• desiredSignalSymbolic = DiscreteSystemSimulation[unknownSystem,inputSignal]
• {{-0.0026 b0}, {-0.1111 b0 - 0.0026 b1}, {0.0751 b0 - 0.1111 b1 - 0.0026 b2}, {0.05 b0 + 0.0751 b1 - 0.1111 b2 - 0.0026 b3}, {-0.0517 b0 + 0.05 b1 + 0.0751 b2 - 0.1111 b3 - 0.0026 b4}, … }={{0.000013}, {0.0006075}, {0.0015865}, {-0.013902}, ...}
Automatic Gain Control
Nonlinear
Power
System output
Scaled Signal
Gain
Power
Algorithm development
Efficient method for approximating the reciprocal using a modified Newton-Raphson iteration
yn 1 1 b x2nx
Algorithm development1. Draw the schematic of algorithm2. Automatically generate a code that implements the system
DiscreteSystemImplementation[systemNR, "implementNR"];3. Compute the successive output values
{{y2}, {d2}} = implementNR[{x,2}, {d1}, {}];{{y3}, {d3}} = implementNR[{x,2}, {d2}, {}];
4. Eliminate the initial states and find the relation between the output sampleseqns = Reduce[{y[n - 1] == y2, y[n] == y3}, {d1}];
5. Find the recurrence equationreducedEqn = (x*y[n-1]^2 == 2*y[n-1] - y[n]);
6. Load knowledge for solving recurrence equations<<DiscreteMath`RSolve`
7. Find a closed-form solutionsol = RSolve[{reducedEqn,y[0]==b},y[n],n];
yn 1 1 b x2nx
Algorithm development: Optimization of initial guess
• Example: algorithm for implementation of an efficient method for approximating the reciprocal using a modified Newton-Raphson iteration
• Find the initial guess to minimize the error of the approximate reciprocal in terms of the given number x, the initial guess b and the number of iterations n:FindRoot[e[n] + 1/2^16 == 0, {b,2}];
• Solution: b = 1.98923
• The error is smaller than 2-16 for x over the range 0.01 < x < 1
Conclusion
• Contemporary trends to use very sophisticated algorithms combine expertise in many areas, such as communications engineering, computer science, ICT, and signal processing
• Current symbolic computation environments are powerful in doing symbolic and mixed symbolic-numeric mathematics for technical computing
Conclusion (2)
• Programs provide knowledge about design and employ the knowledge in symbolic manipulation:
a) automated generation of schematic objects and the corresponding implementation codes
b) derivation of the transfer function, system properties and time response
c) symbolic optimization
Conclusion (3)
• Superiority of symbolic computation against numerical computation was shown by
a) the example system with an algebraic loop; CAS yielded the exact solution while the traditional numeric approach failed
b) the closed-form solution of a nonlinear LMS subsystem
c) deriving the analytic expression for the error of the Newton-Raphson iteration
Conclusion (4)
• Benefits of symbolic methods were highlighted from the viewpoint of
a) Academia (derivation of time and frequency response, proving system properties)
b) Industry (QAM, Hilbert transformer, LMS algorithm, verification of realizations, design alternatives in multirate systems)
Examples and documentationhttp://library.wolfram.com/infocenter/TechNotes/4814/
http://www.schematicsolver.com
Further reading
2001
2002
2002
2004
2004
top related