Simulation of Wireless Communication Systems

54,993 views

Published on

An introduction to modeling and simulation of wireless communications using MATLAB.

Published in: Technology, Business
96 Comments
205 Likes
Statistics
Notes
No Downloads
Views
Total views
54,993
On SlideShare
0
From Embeds
0
Number of Embeds
3,962
Actions
Shares
0
Downloads
0
Comments
96
Likes
205
Embeds 0
No embeds

No notes for slide

Simulation of Wireless Communication Systems

  1. 1. Modeling of Wireless Communication Systems using MATLAB Dr. B.-P. Paris Dept. Electrical and Comp. Engineering George Mason University last updated September 23, 2009 ©2009, B.-P. Paris Wireless Communications 1
  2. 2. Approach This course aims to cover both theory and practice of wireless commuication systems, and the simulation of such systems using MATLAB. Both topics are given approximately equal treatment. After a brief introduction to MATLAB, theory and MATLAB simulation are pursued in parallel. This approach allows us to make concepts concrete and/or to visualize relevant signals. In the process, a toolbox of MATLAB functions is constructed. Hopefully, the toolbox will be useful for your own projects. Illustrates good MATLAB practices. ©2009, B.-P. Paris Wireless Communications 2
  3. 3. Outline - Prologue: Just Enough MATLAB to ... Prologue: Learning Objectives User Interface Working with Vectors Visualization ©2009, B.-P. Paris Wireless Communications 3
  4. 4. Outline - Part I: From Theory to Simulation Part I: Learning Objectives Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation ©2009, B.-P. Paris Wireless Communications 4
  5. 5. Outline - Part II: Digital Modulation and Spectrum Part II: Learning Objectives Linear Modulation Formats and their Spectra Spectrum Estimation in MATLAB Non-linear Modulation Wide-Band Modulation ©2009, B.-P. Paris Wireless Communications 5
  6. 6. Outline - Part III: The Wireless Channel Part III: Learning Objectives Pathloss and Link Budget From Physical Propagation to Multi-Path Fading Statistical Characterization of Channels ©2009, B.-P. Paris Wireless Communications 6
  7. 7. Outline - Part IV: Mitigating the Wireless Channel Part IV: Learning Objectives The Importance of Diversity Frequency Diversity: Wide-Band Signals ©2009, B.-P. Paris Wireless Communications 7
  8. 8. User Interface Working with Vectors Visualization Part I Prologue: Just Enough MATLAB to ... ©2009, B.-P. Paris Wireless Communications 8
  9. 9. User Interface Working with Vectors Visualization Prologue: Just Enough MATLAB to ... MATLAB will be used throughout this course to illustrate theory and key concepts. MATLAB is very well suited to model communications systems: Signals are naturally represented in MATLAB, MATLAB has a very large library of functions for processing signals, Visualization of signals is very well supported in MATLAB. MATLAB is used interactively. Eliminates code, compile, run cycle. Great for rapid prototyping and what-if analysis. ©2009, B.-P. Paris Wireless Communications 9
  10. 10. User Interface Working with Vectors Visualization Outline Prologue: Learning Objectives User Interface Working with Vectors Visualization ©2009, B.-P. Paris Wireless Communications 10
  11. 11. User Interface Working with Vectors Visualization Learning Objectives Getting around in MATLAB The user interface, Getting help. Modeling signals in MATLAB Using vectors to model signals, Creating and manipulating vectors, Visualizing vectors: plotting. ©2009, B.-P. Paris Wireless Communications 11
  12. 12. User Interface Working with Vectors Visualization Outline Prologue: Learning Objectives User Interface Working with Vectors Visualization ©2009, B.-P. Paris Wireless Communications 12
  13. 13. User Interface Working with Vectors Visualization MATLAB’s Main Window ©2009, B.-P. Paris Wireless Communications 13
  14. 14. User Interface Working with Vectors Visualization MATLAB’s Built-in IDE ©2009, B.-P. Paris Wireless Communications 14
  15. 15. User Interface Working with Vectors Visualization MATLAB’s Built-in Help System MATLAB has an extensive built-in help system. On-line documentation reader: contains detailed documentation for entire MATLAB system, is invoked by typing doc at command line clicking “Question Mark” in tool bar of main window, via “Help” menu. Command-line help provides access to documentation inside command window. Helpful commands include: help function-name, e.g., help fft. lookfor keyword, e.g., lookfor inverse. We will learn how to tie into the built-in help system. ©2009, B.-P. Paris Wireless Communications 15
  16. 16. User Interface Working with Vectors Visualization Interacting with MATLAB You interact with MATLAB by typing commands at the command prompt (» ) in the command window. MATLAB’s response depends on whether a semicolon is appended after the command or not. If a semicolon is not appended, then MATLAB displays the result of the command. With a semicolon, the result is not displayed. Examples: The command xx = 1:3 produces xx = 1 2 3 The command xx = 1:3; produces no output. The variable xx still stores the result. Do use a semicolon with xx = 1:30000000; ©2009, B.-P. Paris Wireless Communications 16
  17. 17. User Interface Working with Vectors Visualization Outline Prologue: Learning Objectives User Interface Working with Vectors Visualization ©2009, B.-P. Paris Wireless Communications 17
  18. 18. User Interface Working with Vectors Visualization Signals and Vectors Our objective is to simulate communication systems in MATLAB. This includes the signals that occur in such systems, and processing applied to these signals. In MATLAB (and any other digital system) signals must be represented by samples. Well-founded theory exists regarding sampling (Nyquist’s sampling theorem). Result: Signals are represented as a sequence of numbers. MATLAB is ideally suited to process sequences of numbers. MATLAB’s basic data types: vectors (and matrices). Vectors are just sequence of numbers. ©2009, B.-P. Paris Wireless Communications 18
  19. 19. User Interface Working with Vectors Visualization Illustration: Generating a Sinusoidal Signal The following, simple task illustrates key benefits from MATLAB’s use of vectors. Task: Generate samples of the sinusoidal signal π x (t ) = 3 · cos(2π440t − ) 4 for t ranging from 0 to 10 ms. The sampling rate is 20 KHz. Objective: Compare how this task is accomplished using MATLAB’s vector function, traditional (C-style) for or while loops. ©2009, B.-P. Paris Wireless Communications 19
  20. 20. User Interface Working with Vectors Visualization Illustration: Generating a Sinusoidal Signal For both approaches, we begin by defining a few parameters. This increases readability and makes it easier to change parameters. %% Set Parameters A = 3; % amplitude f = 440; % frequency phi = -pi/4; % phase 7 fs = 20e3; % sampling rate Ts = 0; % start time Te = 10e-3; % end time ©2009, B.-P. Paris Wireless Communications 20
  21. 21. User Interface Working with Vectors Visualization Using Loops The MATLAB code below uses a while loop to generate the samples one by one. The majority of the code is devoted to “book-keeping” tasks. Listing : generateSinusoidLoop.m %initialize loop variables tcur = Ts; kk = 1; 17 while( tcur <= Te) % compute current sample and store in vector tt(kk) = tcur; xx(kk) = A*cos(2*pi*f*tcur + phi); 22 %increment loop variables kk = kk+1; tcur = tcur + 1/fs; end ©2009, B.-P. Paris Wireless Communications 21
  22. 22. User Interface Working with Vectors Visualization Vectorized Code Much more compact code is possible with MATLAB’s vector functions. There is no overhead for managing a program loop. Notice how similar the instruction to generate the samples is to the equation for the signal. The vector-based approach is the key enabler for rapid prototyping. Listing : generateSinusoid.m %% generate sinusoid tt = Ts : 1/fs : Te; % define time-axis xx = A * cos( 2*pi * f * tt + phi ); ©2009, B.-P. Paris Wireless Communications 22
  23. 23. User Interface Working with Vectors Visualization Commands for Creating Vectors The following commands all create useful vectors. [ ]: the sequence of samples is explicitly specified. Example: xx = [ 1 3 2 ] produces xx = 1 3 2. :(colon operator): creates a vector of equally spaced samples. Example: tt = 0:2:9 produces tt = 0 2 4 6 8. Example: tt = 1:3 produces tt = 1 2 3. Idiom: tt = ts:1/fs:te creates a vector of sampling times between ts and te with sampling period 1/fs (i.e., the sampling rate is fs). ©2009, B.-P. Paris Wireless Communications 23
  24. 24. User Interface Working with Vectors Visualization Creating Vectors of Constants ones(n,m): creates an n × m matrix with all elements equal to 1. Example: xx = ones(1,5) produces xx = 1 1 1 1 1. Example: xx = 4*ones(1,5) produces xx = 4 4 4 4 4. zeros(n,m): creates an n × m matrix with all elements equal to 0. Often used for initializing a vector. Usage identical to ones. Note: throughout we adopt the convention that signals are represented as row vectors. The first (column) dimension equals 1. ©2009, B.-P. Paris Wireless Communications 24
  25. 25. User Interface Working with Vectors Visualization Creating Random Vectors We will often need to create vectors of random numbers. E.g., to simulate noise. The following two functions create random vectors. randn(n,m): creates an n × m matrix of independent Gaussian random numbers with mean zero and variance one. Example: xx = randn(1,5) may produce xx = -0.4326 -1.6656 0.1253 0.2877 -1.1465. rand(n,m): creates an n × m matrix of independent uniformly distributed random numbers between zero and one. Example: xx = rand(1,5) may produce xx = 0.1576 0.9706 0.9572 0.4854 0.8003. ©2009, B.-P. Paris Wireless Communications 25
  26. 26. User Interface Working with Vectors Visualization Addition and Subtraction The standard + and - operators are used to add and subtract vectors. One of two conditions must hold for this operation to succeed. Both vectors must have exactly the same size. In this case, corresponding elements in the two vectors are added and the result is another vector of the same size. Example: [1 3 2] + 1:3 produces 2 5 5. A prominent error message indicates when this condition is violated. One of the operands is a scalar, i.e., a 1 × 1 (degenerate) vector. In this case, each element of the vector has the scalar added to it. The result is a vector of the same size as the vector operand. Example: [1 3 2] + 2 produces 3 5 4. ©2009, B.-P. Paris Wireless Communications 26
  27. 27. User Interface Working with Vectors Visualization Element-wise Multiplication and Division The operators .* and ./ operators multiply or divide two vectors element by element. One of two conditions must hold for this operation to succeed. Both vectors must have exactly the same size. In this case, corresponding elements in the two vectors are multiplied and the result is another vector of the same size. Example: [1 3 2] .* 1:3 produces 1 6 6. An error message indicates when this condition is violated. One of the operands is a scalar. In this case, each element of the vector is multiplied by the scalar. The result is a vector of the same size as the vector operand. Example: [1 3 2] .* 2 produces 2 6 4. If one operand is a scalar the ’.’ may be omitted, i.e., [1 3 2] * 2 also produces 2 6 4. ©2009, B.-P. Paris Wireless Communications 27
  28. 28. User Interface Working with Vectors Visualization Inner Product The operator * with two vector arguments computes the inner product (dot product) of the vectors. Recall the inner product of two vectors is defined as N x ·y = ∑ x (n ) · y (n ). n =1 This implies that the result of the operation is a scalar! The inner product is a useful and important signal processing operation. It is very different from element-wise multiplication. The second dimension of the first operand must equal the first dimension of the second operand. MATLAB error message: Inner matrix dimensions must agree. Example: [1 3 2] * (1:3)’ = 13. The single quote (’) transposes a vector. ©2009, B.-P. Paris Wireless Communications 28
  29. 29. User Interface Working with Vectors Visualization Powers To raise a vector to some power use the .^ operator. Example: [1 3 2].^2 yields 1 9 4. The operator ^ exists but is generally not what you need. Example: [1 3 2]^2 is equivalent to [1 3 2] * [1 3 2] which produces an error. Similarly, to use a vector as the exponent for a scalar base use the .^ operator. Example: 2.^[1 3 2] yields 2 8 4. Finally, to raise a vector of bases to a vector of exponents use the .^ operator. Example: [1 3 2].^(1:3) yields 1 9 8. The two vectors must have the same dimensions. The .^ operator is (nearly) always the right operator. ©2009, B.-P. Paris Wireless Communications 29
  30. 30. User Interface Working with Vectors Visualization Complex Arithmetic MATLAB support complex numbers fully and naturally. √ The imaginary unit i = −1 is a built-in constant named i and j. Creating complex vectors: Example: xx = randn(1,5) + j*randn(1,5) creates a vector of complex Gaussian random numbers. A couple of “gotchas” in connection with complex arithmetic: Never use i and j as variables! Example: After invoking j=2, the above command will produce very unexpected results. Transposition operator (’) transposes and forms conjugate complex. That is very often the right thing to do. Transpose only is performed with .’ operator. ©2009, B.-P. Paris Wireless Communications 30
  31. 31. User Interface Working with Vectors Visualization Vector Functions MATLAB has literally hundreds of built-in functions for manipulating vectors and matrices. The following will come up repeatedly: yy=cos(xx), yy=sin(xx), and yy=exp(xx): compute the cosine, sine, and exponential for each element of vector xx, the result yy is a vector of the same size as xx. XX=fft(xx), xx=ifft(XX): Forward and inverse discrete Fourier transform (DFT), computed via an efficient FFT algorithm. Many algebraic functions are available, including log10, sqrt, abs, and round. Try help elfun for a complete list. ©2009, B.-P. Paris Wireless Communications 31
  32. 32. User Interface Working with Vectors Visualization Functions Returning a Scalar Result Many other functions accept a vector as its input and return a scalar value as the result. Examples include min and max, mean and var or std, sum computes the sum of the elements of a vector, norm provides the square root of the sum of the squares of the elements of a vector. The norm of a vector is related to power and energy. Try help datafun for an extensive list. ©2009, B.-P. Paris Wireless Communications 32
  33. 33. User Interface Working with Vectors Visualization Accessing Elements of a Vector Frequently it is necessary to modify or extract a subset of the elements of a vector. Accessing a single element of a vector: Example: Let xx = [1 3 2], change the third element to 4. Solution: xx(3) = 4; produces xx = 1 3 4. Single elements are accessed by providing the index of the element of interest in parentheses. ©2009, B.-P. Paris Wireless Communications 33
  34. 34. User Interface Working with Vectors Visualization Accessing Elements of a Vector Accessing a range of elements of a vector: Example: Let xx = ones(1,10);, change the first five elements to −1. Solution: xx(1:5) = -1*ones(1,5); Note, xx(1:5) = -1 works as well. Example: Change every other element of xx to 2. Solution: xx(2:2:end) = 2;; Note that end may be use to denote the index of a vector’s last element. This is handy if the length of the vector is not known. Example: Change third and seventh element to 3. Solution: xx([3 7]) = 3;; A set of elements of a vector is accessed by providing a vector of indices in parentheses. ©2009, B.-P. Paris Wireless Communications 34
  35. 35. User Interface Working with Vectors Visualization Accessing Elements that Meet a Condition Frequently one needs to access all elements of a vector that meet a given condition. Clearly, that could be accomplished by writing a loop that examines and processes one element at a time. Such loops are easily avoided. Example: “Poor man’s absolute value” Assume vector xx contains both positive and negative numbers. (e.g., xx = randn(1,10);). Objective: Multiply all negative elements of xx by −1; thus compute the absolute value of all elements of xx. Solution: proceeds in two steps isNegative = (xx < 0); xx(isNegative) = -xx(isNegative); The vector isNegative consists of logical (boolean) values; 1’s appear wherever an element of xx is negative. ©2009, B.-P. Paris Wireless Communications 35
  36. 36. User Interface Working with Vectors Visualization Outline Prologue: Learning Objectives User Interface Working with Vectors Visualization ©2009, B.-P. Paris Wireless Communications 36
  37. 37. User Interface Working with Vectors Visualization Visualization and Graphics MATLAB has powerful, built-in functions for plotting functions in two and three dimensions. Publication quality graphs are easily produced in a variety of standard graphics formats. MATLAB provides fine-grained control over all aspects of the final graph. ©2009, B.-P. Paris Wireless Communications 37
  38. 38. User Interface Working with Vectors Visualization A Basic Plot The sinusoidal signal, we generated earlier is easily plotted via the following sequence of commands: Try help plot for more information about the capabilities of the plot command. %% Plot plot(tt, xx, ’r’) % xy-plot, specify red line xlabel( ’Time (s)’ ) % labels for x and y axis ylabel( ’Amplitude’ ) 10 title( ’x(t) = A cos(2pi f t + phi)’) grid % create a grid axis([0 10e-3 -4 4]) % tweak the range for the axes ©2009, B.-P. Paris Wireless Communications 38
  39. 39. User Interface Working with Vectors Visualization Resulting Plot x(t) = A cos (2π f t + φ) 4 2 Amplitude 0 −2 −4 0 0.002 0.004 0.006 0.008 0.01 Time (s) ©2009, B.-P. Paris Wireless Communications 39
  40. 40. User Interface Working with Vectors Visualization Multiple Plots in One Figure MATLAB can either put multiple graphs in the same plot or put multiple plots side by side. The latter is accomplished with the subplot command. subplot(2,1,1) plot(tt, xx ) % xy-plot xlabel( ’Time (s)’ ) % labels for x and y axis ylabel( ’Amplitude’ ) 12 title( ’x(t) = A cos(2pi f t + phi)’) subplot(2,1,2) plot(tt, yy ) % xy-plot xlabel( ’Time (s)’ ) % labels for x and y axis 17 ylabel( ’Amplitude’ ) title( ’x(t) = A sin(2pi f t + phi)’) ©2009, B.-P. Paris Wireless Communications 40
  41. 41. User Interface Working with Vectors Visualization Resulting Plot x(t) = A cos(2π f t + φ) 4 2 Amplitude 0 −2 −4 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01 Time (s) x(t) = A sin(2π f t + φ) 4 2 Amplitude 0 −2 −4 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01 Time (s) ©2009, B.-P. Paris Wireless Communications 41
  42. 42. User Interface Working with Vectors Visualization 3-D Graphics MATLAB provides several functions that create high-quality three-dimensional graphics. The most important are: plot3(x,y,z): plots a function of two variables. mesh(x,y,Z): plots a mesh of the values stored in matrix Z over the plane spanned by vectors x and y. surf(x,y,Z): plots a surface from the values stored in matrix Z over the plane spanned by vectors x and y. A relevant example is shown on the next slide. The path loss in a two-ray propagation environment over a flat, reflecting surface is shown as a function of distance and frequency. ©2009, B.-P. Paris Wireless Communications 42
  43. 43. User Interface Working with Vectors Visualization 1.02 1.01 1 0.99 2 10 0.98 0.97 0.96 0.95 1 10 Frequency (GHz) Distance (m) Figure: Path loss over a flat reflecting surface. ©2009, B.-P. Paris Wireless Communications 43
  44. 44. User Interface Working with Vectors Visualization Summary We have taken a brief look at the capabilities of MATLAB. Specifically, we discussed Vectors as the basic data unit used in MATLAB, Arithmetic with vectors, Prominent vector functions, Visualization in MATLAB. We will build on this basis as we continue and apply MATLAB to the simulation of communication systems. To probe further: Read the built-in documentation. Recommended MATLAB book: D. Hanselman and B. Littlefield, Mastering MATLAB, Prentice-Hall. ©2009, B.-P. Paris Wireless Communications 44
  45. 45. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Part II Introduction: From Theory to Simulation ©2009, B.-P. Paris Wireless Communications 45
  46. 46. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Introduction: From Theory to Simulation Introduction to digital communications and simulation of digital communications systems. A simple digital communication system and its theoretical underpinnings Introduction to digital modulation Baseband and passband signals: complex envelope Noise and Randomness The matched filter receiver Bit-error rate Example: BPSK over AWGN, simulation in MATLAB ©2009, B.-P. Paris Wireless Communications 46
  47. 47. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Outline Part I: Learning Objectives Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation ©2009, B.-P. Paris Wireless Communications 47
  48. 48. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Learning Objectives Theory of Digital Communications. Principles of Digital modulation. Communications Channel Model: Additive, White Gaussian Noise. The Matched Filter Receiver. Finding the Probability of Error. Modeling a Digital Communications System in MATLAB. Representing Signals and Noise in MATLAB. Simulating a Communications System. Measuring Probability of Error via MATLAB Simulation. ©2009, B.-P. Paris Wireless Communications 48
  49. 49. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Outline Part I: Learning Objectives Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation ©2009, B.-P. Paris Wireless Communications 49
  50. 50. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Elements of a Digital Communications System Source: produces a sequence of information symbols b. Transmitter: maps bit sequence to analog signal s (t ). Channel: models corruption of transmitted signal s (t ). Receiver: produces reconstructed sequence of information ˆ symbols b from observed signal R (t ). b s (t ) R (t ) ˆ b Source Transmitter Channel Receiver Figure: Block Diagram of a Generic Digital Communications System ©2009, B.-P. Paris Wireless Communications 50
  51. 51. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Source The source models the statistical properties of the digital information source. Three main parameters: Source Alphabet: list of the possible information symbols the source produces. Example: A = {0, 1}; symbols are called bits. Alphabet for a source with M (typically, a power of 2) symbols: A = {0, 1, . . . , M − 1} or A = {±1, ±3, . . . , ±(M − 1)}. Alphabet with positive and negative symbols is often more convenient. Symbols may be complex valued; e.g., A = {±1, ±j }. ©2009, B.-P. Paris Wireless Communications 51
  52. 52. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation A priori Probability: relative frequencies with which the source produces each of the symbols. Example: a binary source that produces (on average) equal numbers of 0 and 1 bits has 1 π0 = π1 = 2 . Notation: πn denotes the probability of observing the n-th symbol. Typically, a-priori probabilities are all equal, 1 i.e., πn = M . A source with M symbols is called an M-ary source. binary (M = 2) ternary (M = 3) quaternary (M = 4) ©2009, B.-P. Paris Wireless Communications 52
  53. 53. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Symbol Rate: The number of information symbols the source produces per second. Also called the baud rate R. Closely related: information rate Rb indicates the number of bits the source produces per second. Relationship: Rb = R · log2 (M ). Also, T = 1/R is the symbol period. Bit 1 Bit 2 Symbol 0 0 0 0 1 1 1 0 2 1 1 3 Table: Two bits can be represented in one quaternary symbol. ©2009, B.-P. Paris Wireless Communications 53
  54. 54. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Remarks This view of the source is simplified. We have omitted important functionality normally found in the source, including error correction coding and interleaving, and mapping bits to symbols. This simplified view is sufficient for our initial discussions. Missing functionality will be revisited when needed. ©2009, B.-P. Paris Wireless Communications 54
  55. 55. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Modeling the Source in MATLAB Objective: Write a MATLAB function to be invoked as: Symbols = RandomSymbols( N, Alphabet, Priors); The input parameters are N: number of input symbols to be produced. Alphabet: source alphabet to draw symbols from. Example: Alphabet = [1 -1]; Priors: a priori probabilities for the input symbols. Example: Priors = ones(size(Alphabet))/length(Alphabet); The output Symbols is a vector with N elements, drawn from Alphabet, and the number of times each symbol occurs is (approximately) proportional to the corresponding element in Priors. ©2009, B.-P. Paris Wireless Communications 55
  56. 56. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Reminders MATLAB’s basic data units are vectors and matrices. Vectors are best thought of as lists of numbers; vectors often contain samples of a signal. There are many ways to create vectors, including Explicitly: Alphabet = [1 -1]; Colon operator: nn = 1:10; Via a function: Priors=ones(1,5)/5; This leads to very concise programs; for-loops are rarely needed. MATLAB has a very large number of available functions. Reduces programming to combining existing building blocks. Difficulty: find out what is available; use built-in help. ©2009, B.-P. Paris Wireless Communications 56
  57. 57. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Writing a MATLAB Function A MATLAB function must begin with a line of the form function [out1,out2] = FunctionName(in1, in2, in3) be stored in a file with the same name as the function name and extension ’.m’. For our symbol generator, the file name must be RandomSymbols.m and the first line must be function Symbols = RandomSymbols(N, Alphabet, Priors) ©2009, B.-P. Paris Wireless Communications 57
  58. 58. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Writing a MATLAB Function A MATLAB function should have a second line of the form %FunctionName - brief description of function This line is called the “H1 header.” have a more detailed description of the function and how to use it on subsequent lines. The detailed description is separated from the H1 header by a line with only a %. Each of these lines must begin with a % to mark it as a comment. These comments become part of the built-in help system. ©2009, B.-P. Paris Wireless Communications 58
  59. 59. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Header of Function RandomSymbols function Symbols = RandomSymbols(N, Alphabet, Priors) % RandomSymbols - generate a vector of random information symbols % % A vector of N random information symbols drawn from a given 5 % alphabet and with specified a priori probabilities is produced. % % Inputs: % N - number of symbols to be generated % Alphabet - vector containing permitted symbols 10 % Priors - a priori probabilities for symbols % % Example: % Symbols = RandomSymbols(N, Alphabet, Priors) ©2009, B.-P. Paris Wireless Communications 59
  60. 60. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Algorithm for Generating Random Symbols For each of the symbols to be generated we use the following algorithm: Begin by computing the cumulative sum over the priors. Example: Let Priors = [0.25 0.25 0.5], then the cumulative sum equals CPriors = [0 0.25 0.5 1]. For each symbol, generate a uniform random number between zero and one. The MATLAB function rand does that. Determine between which elements of the cumulative sum the random number falls and select the corresponding symbol from the alphabet. Example: Assume the random number generated is 0.3. This number falls between the second and third element of CPriors. The second symbol from the alphabet is selected. ©2009, B.-P. Paris Wireless Communications 60
  61. 61. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation MATLAB Implementation In MATLAB, the above algorithm can be “vectorized” to work on the entire sequence at once. CPriors = [0 cumsum( Priors )]; rr = rand(1, N); for kk=1:length(Alphabet) 42 Matches = rr > CPriors(kk) & rr <= CPriors(kk+1); Symbols( Matches ) = Alphabet( kk ); end ©2009, B.-P. Paris Wireless Communications 61
  62. 62. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Testing Function RandomSymols We can invoke and test the function RandomSymbols as shown below. A histogram of the generated symbols should reflect the specified a priori probabilities. %% set parameters N = 1000; Alphabet = [-3 -1 1 3]; Priors = [0.1 0.2 0.3 0.4]; 10 %% generate symbols and plot histogram Symbols = RandomSymbols( N, Alphabet, Priors ); hist(Symbols, -4:4 ); grid 15 xlabel(’Symbol Value’) ylabel(’Number of Occurences’) ©2009, B.-P. Paris Wireless Communications 62
  63. 63. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Resulting Histogram 400 350 300 Number of Occurences 250 200 150 100 50 0 −4 −3 −2 −1 0 1 2 3 4 Symbol Value ©2009, B.-P. Paris Wireless Communications 63
  64. 64. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Transmitter The transmitter translates the information symbols at its input into signals that are “appropriate” for the channel, e.g., meet bandwidth requirements due to regulatory or propagation considerations, provide good receiver performance in the face of channel impairments: noise, distortion (i.e., undesired linear filtering), interference. A digital communication system transmits only a discrete set of information symbols. Correspondingly, only a discrete set of possible signals is employed by the transmitter. The transmitted signal is an analog (continuous-time, continuous amplitude) signal. ©2009, B.-P. Paris Wireless Communications 64
  65. 65. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Illustrative Example The sources produces symbols from the alphabet A = {0, 1}. The transmitter uses the following rule to map symbols to signals: If the n-th symbol is bn = 0, then the transmitter sends the signal A for (n − 1)T ≤ t < nT s0 (t ) = 0 else. If the n-th symbol is bn = 1, then the transmitter sends the signal for (n − 1)T ≤ t < (n − 1 )T   A 2 s1 (t ) = −A for (n − 1 )T ≤ t < nT 2 0 else.  ©2009, B.-P. Paris Wireless Communications 65
  66. 66. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Symbol Sequence b = {1, 0, 1, 1, 0, 0, 1, 0, 1, 0} 4 2 Amplitude 0 −2 −4 0 2 4 6 8 10 Time/T ©2009, B.-P. Paris Wireless Communications 66
  67. 67. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation MATLAB Code for Example Listing : plot_TxExampleOrth.m b = [ 1 0 1 1 0 0 1 0 1 0]; %symbol sequence fsT = 20; % samples per symbol period A = 3; 6 Signals = A*[ ones(1,fsT); % signals, one per row ones(1,fsT/2) -ones(1,fsT/2)]; tt = 0:1/fsT:length(b)-1/fsT; % time axis for plotting 11 %% generate signal ... TXSignal = []; for kk=1:length(b) TXSignal = [ TXSignal Signals( b(kk)+1, : ) ]; 16 end ©2009, B.-P. Paris Wireless Communications 67
  68. 68. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation MATLAB Code for Example Listing : plot_TxExampleOrth.m %% ... and plot plot(tt, TXSignal) 20 axis([0 length(b) -(A+1) (A+1)]); grid xlabel(’Time/T’) ©2009, B.-P. Paris Wireless Communications 68
  69. 69. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Communications Channel The communications channel models the degradation the transmitted signal experiences on its way to the receiver. For wireless communications systems, we are concerned primarily with: Noise: random signal added to received signal. Mainly due to thermal noise from electronic components in the receiver. Can also model interference from other emitters in the vicinity of the receiver. Statistical model is used to describe noise. Distortion: undesired filtering during propagation. Mainly due to multi-path propagation. Both deterministic and statistical models are appropriate depending on time-scale of interest. Nature and dynamics of distortion is a key difference to wired systems. ©2009, B.-P. Paris Wireless Communications 69
  70. 70. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Thermal Noise At temperatures above absolute zero, electrons move randomly in a conducting medium, including the electronic components in the front-end of a receiver. This leads to a random waveform. The power of the random waveform equals PN = kT0 B. k : Boltzmann’s constant (1.38 · 10−23 Ws/K). T0 : temperature in degrees Kelvin (room temperature ≈ 290 K). For bandwidth equal to 1 MHz, PN ≈ 4 · 10−15 W (−114 dBm). Noise power is small, but power of received signal decreases rapidly with distance from transmitter. Noise provides a fundamental limit to the range and/or rate at which communication is possible. ©2009, B.-P. Paris Wireless Communications 70
  71. 71. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Multi-Path In a multi-path environment, the receiver sees the combination of multiple scaled and delayed versions of the transmitted signal. TX RX ©2009, B.-P. Paris Wireless Communications 71
  72. 72. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Distortion from Multi-Path 5 Received signal “looks” very different from Amplitude transmitted signal. 0 Inter-symbol interference (ISI). Multi-path is a very serious problem −5 for wireless 0 2 4 6 8 10 systems. Time/T ©2009, B.-P. Paris Wireless Communications 72
  73. 73. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Receiver The receiver is designed to reconstruct the original information sequence b. Towards this objective, the receiver uses the received signal R (t ), knowledge about how the transmitter works, Specifically, the receiver knows how symbols are mapped to signals. the a-priori probability and rate of the source. The transmitted signal typically contains information that allows the receiver to gain information about the channel, including training sequences to estimate the impulse response of the channel, synchronization preambles to determine symbol locations and adjust amplifier gains. ©2009, B.-P. Paris Wireless Communications 73
  74. 74. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Receiver The receiver input is an analog signal and it’s output is a sequence of discrete information symbols. Consequently, the receiver must perform analog-to-digital conversion (sampling). Correspondingly, the receiver can be divided into an analog front-end followed by digital processing. Modern receivers have simple front-ends and sophisticated digital processing stages. Digital processing is performed on standard digital hardware (from ASICs to general purpose processors). Moore’s law can be relied on to boost the performance of digital communications systems. ©2009, B.-P. Paris Wireless Communications 74
  75. 75. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Measures of Performance The receiver is expected to perform its function optimally. Question: optimal in what sense? Measure of performance must be statistical in nature. observed signal is random, and transmitted symbol sequence is random. Metric must reflect the reliability with which information is reconstructed at the receiver. Objective: Design the receiver that minimizes the probability of a symbol error. Also referred to as symbol error rate. Closely related to bit error rate (BER). ©2009, B.-P. Paris Wireless Communications 75
  76. 76. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Summary We have taken a brief look at the elements of a communication system. Source, Transmitter, Channel, and Receiver. We will revisit each of these elements for a more rigorous analysis. Intention: Provide enough detail to allow simulation of a communication system. ©2009, B.-P. Paris Wireless Communications 76
  77. 77. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Outline Part I: Learning Objectives Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation ©2009, B.-P. Paris Wireless Communications 77
  78. 78. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Digital Modulation Digital modulation is performed by the transmitter. It refers to the process of converting a sequence of information symbols into a transmitted (analog) signal. The possibilities for performing this process are virtually without limits, including varying, the amplitude, frequency, and/or phase of a sinusoidal signal depending on the information sequence, making the currently transmitted signal on some or all of the previously transmitted symbols (modulation with memory). Initially, we focus on a simple, yet rich, class of modulation formats referred to as linear modulation. ©2009, B.-P. Paris Wireless Communications 78
  79. 79. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation Linear modulation may be thought of as the digital equivalent of amplitude modulation. The instantaneous amplitude of the transmitted signal is proportional to the current information symbol. Specifically, a linearly modulated signal may be written as N −1 s (t ) = ∑ bn · p (t − nT ) n =0 where, bn denotes the n-th information symbol, and p (t ) denotes a pulse of finite duration. Recall that T is the duration of a symbol. ©2009, B.-P. Paris Wireless Communications 79
  80. 80. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation Note, that the expression N −1 bn s (t ) s (t ) = ∑ bn · p (t − nT ) × p (t ) n =0 is linear in the symbols bn . Different modulation formats are ∑ δ(t − nT ) constructed by choosing appropriate symbol alphabets, e.g., BPSK: bn ∈ {1, −1} OOK: bn ∈ {0, 1} PAM: bn ∈ {±1, . . . , ±(M − 1)}. ©2009, B.-P. Paris Wireless Communications 80
  81. 81. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation in MATLAB To simulate a linear modulator in MATLAB, we will need a function with a function header like this: function Signal = LinearModulation( Symbols, Pulse, fsT ) % LinearModulation - linear modulation of symbols with given 3 % pulse shape % % A sequence of information symbols is linearly modulated. Pulse % shaping is performed using the pulse shape passed as input % parameter Pulse. The integer fsT indicates how many samples 8 % per symbol period are taken. The length of the Pulse vector may % be longer than fsT; this corresponds to partial-response signali % % Inputs: % Symbols - vector of information symbols 13 % Pulse - vector containing the pulse used for shaping % fsT - (integer) number of samples per symbol period ©2009, B.-P. Paris Wireless Communications 81
  82. 82. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation in MATLAB In the body of the function, the sum of the pulses is computed. There are two issues that require some care: Each pulse must be inserted in the correct position in the output signal. Recall that the expression for the output signal s (t ) contains the terms p (t − nT ). The term p (t − nT ) reflects pulses delayed by nT . Pulses may overlap. If the duration of a pulse is longer than T , then pulses overlap. Such overlapping pulses are added. This situation is called partial response signaling. ©2009, B.-P. Paris Wireless Communications 82
  83. 83. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Body of Function LinearModulation 19 % initialize storage for Signal LenSignal = length(Symbols)*fsT + (length(Pulse))-fsT; Signal = zeros( 1, LenSignal ); % loop over symbols and insert corresponding segment into Signal 24 for kk = 1:length(Symbols) ind_start = (kk-1)*fsT + 1; ind_end = (kk-1)*fsT + length(Pulse); Signal(ind_start:ind_end) = Signal(ind_start:ind_end) + ... 29 Symbols(kk) * Pulse; end ©2009, B.-P. Paris Wireless Communications 83
  84. 84. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Testing Function LinearModulation Listing : plot_LinearModRect.m %% Parameters: fsT = 20; Alphabet = [1,-1]; 6 Priors = 0.5*[1 1]; Pulse = ones(1,fsT); % rectangular pulse %% symbols and Signal using our functions Symbols = RandomSymbols(10, Alphabet, Priors); 11 Signal = LinearModulation(Symbols,Pulse,fsT); %% plot tt = (0 : length(Signal)-1 )/fsT; plot(tt, Signal) axis([0 length(Signal)/fsT -1.5 1.5]) 16 grid xlabel(’Time/T’) ylabel(’Amplitude’) ©2009, B.-P. Paris Wireless Communications 84
  85. 85. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation with Rectangular Pulses 1.5 1 0.5 Amplitude 0 −0.5 −1 −1.5 0 2 4 6 8 10 Time/T ©2009, B.-P. Paris Wireless Communications 85
  86. 86. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation with sinc-Pulses More interesting and practical waveforms arise when smoother pulses are used. A good example are truncated sinc functions. The sinc function is defined as: sin(x ) sinc(x ) = , with sinc(0) = 1. x Specifically, we will use pulses defined by sin(πt /T ) p (t ) = sinc(πt /T ) = ; πt /T pulses are truncated to span L symbol periods, and delayed to be causal. Toolbox contains function Sinc( L, fsT ). ©2009, B.-P. Paris Wireless Communications 86
  87. 87. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation A Truncated Sinc Pulse 1.5 1 Pulse is very smooth, 0.5 spans ten symbol periods, is zero at location of 0 other symbols. Nyquist pulse. −0.5 0 2 4 6 8 10 Time/T ©2009, B.-P. Paris Wireless Communications 87
  88. 88. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Linear Modulation with Sinc Pulses 2 Resulting waveform is 1 also very smooth; expect good spectral properties. Amplitude 0 Symbols are harder to discern; partial response signaling induces −1 “controlled” ISI. But, there is no ISI at symbol locations. −2 0 5 10 15 20 Transients at beginning Time/T and end. ©2009, B.-P. Paris Wireless Communications 88
  89. 89. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Passband Signals So far, all modulated signals we considered are baseband signals. Baseband signals have frequency spectra concentrated near zero frequency. However, for wireless communications passband signals must be used. Passband signals have frequency spectra concentrated around a carrier frequency fc . Baseband signals can be converted to passband signals through up-conversion. Passband signals can be converted to baseband signals through down-conversion. ©2009, B.-P. Paris Wireless Communications 89
  90. 90. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Up-Conversion A cos(2πfc t ) sI (t ) The passband signal sP (t ) is × constructed from two (digitally modulated) baseband signals, sI (t ) sP ( t ) and sQ (t ). + Note that two signals can be carried simultaneously! This is a consequence of sQ (t ) cos(2πfc t ) and sin(2πfc t ) being × orthogonal. A sin(2πfc t ) ©2009, B.-P. Paris Wireless Communications 90
  91. 91. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Baseband Equivalent Signals The passband signal sP (t ) can be written as √ √ sP (t ) = 2 · AsI (t ) · cos(2πfc t ) + 2 · AsQ (t ) · sin(2πfc t ). If we define s (t ) = sI (t ) − j · sQ (t ), then sP (t ) can also be expressed as √ sP (t ) = 2 · A · {s (t ) · exp(j2πfc t )}. The signal s (t ): is called the baseband equivalent or the complex envelope of the passband signal sP (t ). It contains the same information as sP (t ). Note that s (t ) is complex-valued. ©2009, B.-P. Paris Wireless Communications 91
  92. 92. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Illustration: QPSK with fc = 2/T Passband signal (top): 2 segments of sinusoids 1 with different phases. Amplitude 0 Phase changes occur −1 at multiples of T . −2 Baseband signal 0 1 2 3 4 5 6 7 8 9 10 Time/T (bottom) is complex 2 1 valued; magnitude and 1.5 phase are plotted. 0.5 Magnitude is constant Magnitude Phase/π 1 0 (rectangular pulses). 0.5 0 −0.5 0 5 10 0 5 10 Time/T Time/T ©2009, B.-P. Paris Wireless Communications 92
  93. 93. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation MATLAB Code for QPSK Illustration Listing : plot_LinearModQPSK.m %% Parameters: fsT = 20; L = 10; fc = 2; % carrier frequency 7 Alphabet = [1, j, -j, -1];% QPSK Priors = 0.25*[1 1 1 1]; Pulse = ones(1,fsT); % rectangular pulse %% symbols and Signal using our functions 12 Symbols = RandomSymbols(10, Alphabet, Priors); Signal = LinearModulation(Symbols,Pulse,fsT); %% passband signal tt = (0 : length(Signal)-1 )/fsT; Signal_PB = sqrt(2)*real( Signal .* exp(-j*2*pi*fc*tt) ); ©2009, B.-P. Paris Wireless Communications 93
  94. 94. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation MATLAB Code for QPSK Illustration Listing : plot_LinearModQPSK.m subplot(2,1,1) plot( tt, Signal_PB ) grid 22 xlabel(’Time/T’) ylabel(’Amplitude’) subplot(2,2,3) plot( tt, abs( Signal ) ) 27 grid xlabel(’Time/T’) ylabel(’Magnitude’) subplot(2,2,4) 32 plot( tt, angle( Signal )/pi ) grid xlabel(’Time/T’) ylabel(’Phase/pi’) ©2009, B.-P. Paris Wireless Communications 94
  95. 95. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Frequency Domain Perspective In the frequency domain: √ 2 · SP (f + fc ) for f + fc > 0 S (f ) = 0 else. √ Factor 2 ensures both signals have the same power. SP (f ) S (f ) √ 2·A A f f − fc fc − fc fc ©2009, B.-P. Paris Wireless Communications 95
  96. 96. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Baseband Equivalent System The baseband description of the transmitted signal is very convenient: it is more compact than the passband signal as it does not include the carrier component, while retaining all relevant information. However, we are also concerned what happens to the signal as it propagates to the receiver. Question: Do baseband techniques extend to other parts of a passband communications system? ©2009, B.-P. Paris Wireless Communications 96
  97. 97. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Passband System √ √ 2A cos(2πfc t ) 2 cos(2πfc t ) sI (t ) RI (t ) × NP ( t ) × LPF sP ( t ) RP ( t ) + hP (t ) + sQ (t ) RQ (t ) × × LPF √ √ 2A sin(2πfc t ) 2 sin(2πfc t ) ©2009, B.-P. Paris Wireless Communications 97
  98. 98. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Baseband Equivalent System N (t ) s (t ) R (t ) h (t ) + The passband system can be interpreted as follows to yield an equivalent system that employs only baseband signals: baseband equivalent transmitted signal: s (t ) = sI (t ) − j · sQ (t ). baseband equivalent channel with complex valued impulse response: h(t ). baseband equivalent received signal: R ( t ) = RI ( t ) − j · RQ ( t ) . complex valued, additive Gaussian noise: N (t ) ©2009, B.-P. Paris Wireless Communications 98
  99. 99. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Baseband Equivalent Channel The baseband equivalent channel is defined by the entire shaded box in the block diagram for the passband system (excluding additive noise). The relationship between the passband and baseband equivalent channel is hP (t ) = {h(t ) · exp(j2πfc t )} in the time domain. Example: hP ( t ) = ∑ ak · δ(t − τk ) =⇒ h(t ) = ∑ ak · e−j2πf τ c k · δ(t − τk ). k k ©2009, B.-P. Paris Wireless Communications 99
  100. 100. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Baseband Equivalent Channel In the frequency domain HP (f + fc ) for f + fc > 0 H (f ) = 0 else. HP (f ) H (f ) A A f f − fc fc − fc fc ©2009, B.-P. Paris Wireless Communications 100
  101. 101. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Summary The baseband equivalent channel is much simpler than the passband model. Up and down conversion are eliminated. Expressions for signals do not contain carrier terms. The baseband equivalent signals are easier to represent for simulation. Since they are low-pass signals, they are easily sampled. No information is lost when using baseband equivalent signals, instead of passband signals. Standard, linear system equations hold: R (t ) = s (t ) ∗ h(t ) + n(t ) and R (f ) = S (f ) · H (f ) + N (f ). Conclusion: Use baseband equivalent signals and systems. ©2009, B.-P. Paris Wireless Communications 101
  102. 102. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Outline Part I: Learning Objectives Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation ©2009, B.-P. Paris Wireless Communications 102
  103. 103. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Channel Model The channel describes how the transmitted signal is corrupted between transmitter and receiver. The received signal is corrupted by: noise, distortion, due to multi-path propagation, interference. Interference is not considered in detail. Is easily added to simulations, Frequent assumption: interference can be lumped in with noise. ©2009, B.-P. Paris Wireless Communications 103
  104. 104. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Additive White Gaussian Noise A standard assumption in most communication systems is that noise is well modeled as additive, white Gaussian noise (AWGN). additive: channel adds noise to the transmitted signal. white: describes the temporal correlation of the noise. Gaussian: probability distribution is a Normal or Gaussian distribution. Baseband equivalent noise is complex valued. In-phase NI (t ) and quadrature NQ (t ) noise signals are modeled as independent (circular symmetric noise). ©2009, B.-P. Paris Wireless Communications 104
  105. 105. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation White Noise The term white means specifically that the mean of the noise is zero, E[N (t )] = 0, the autocorrelation function of the noise is ρN (τ ) = E[N (t ) · N ∗ (t + τ )] = N0 δ(τ ). This means that any distinct noise samples are independent. The autocorrelation function also indicates that noise samples have infinite variance. Insight: noise must be filtered before it can be sampled. In-phase and quadrature noise each have autocorrelation N0 2 δ ( τ ). ©2009, B.-P. Paris Wireless Communications 105
  106. 106. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation White Noise The term “white” refers to the spectral properties of the noise. Specifically, the power spectral density of white noise is constant over all frequencies: SN (f ) = N0 for all f . White light consists of equal components of the visible spectrum. ©2009, B.-P. Paris Wireless Communications 106
  107. 107. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Generating Gaussian Noise Samples For simulating additive noise, Gaussian noise samples must be generated. MATLAB idiom for generating a vector of N independent, complex, Gaussian random numbers with variance VarNoise: Noise = sqrt(VarNoise/2) * ( randn(1,N) + j * randn(1,N)); Note, that real and imaginary part each have variance VarNoise/2. This causes the total noise variance to equal VarNoise. ©2009, B.-P. Paris Wireless Communications 107
  108. 108. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Toolbox Function addNoise We will frequently simulate additive, white Gaussian noise. To perform this task, a function with the following header is helpful: function NoisySignal = addNoise( CleanSignal, VarNoise ) % addNoise - simulate additive, white Gaussian noise channel % % Independent Gaussian noise of variance specified by the second 5 % input parameter is added to the (vector or matrix) signal passed % as the first input. The result is returned in a vector or matrix % of the same size as the input signal. % % The function determines if the signal is real or complex valued 10 % and generates noise samples accordingly. In either case the total % variance is equal to the second input. ©2009, B.-P. Paris Wireless Communications 108
  109. 109. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation The Body of Function addNoise %% generate noisy signal % distinguish between real and imaginary input signals if ( isreal( CleanSignal ) ) 25 NoisySignal = CleanSignal + ... sqrt(VarNoise) * randn( size(CleanSignal) ); else NoisySignal = CleanSignal + sqrt(VarNoise/2) * ... ( randn( size(CleanSignal) ) + j*randn( size(CleanSignal) ) ); 30 end ©2009, B.-P. Paris Wireless Communications 109
  110. 110. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation 4 2 Amplitude 0 −2 −4 −6 0 5 10 15 20 Time/T Es Figure: Linearly modulated Signal with Noise; N0 ≈ 10 dB, noise 20 variance ≈ 2, noise bandwidth ≈ T . ©2009, B.-P. Paris Wireless Communications 110
  111. 111. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Multi-path Fading Channels In addition to corruption by additive noise, transmitted signals are distorted during propagation from transmitter to receiver. The distortion is due to multi-path propagation. The transmitted signal travels to the receiver along multiple paths, each with different attenuation and delay. The receiver observes the sum of these signals. Effect: undesired filtering of transmitted signal. ©2009, B.-P. Paris Wireless Communications 111
  112. 112. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Multi-path Fading Channels In mobile communications, the characteristics of the multi-path channel vary quite rapidly; this is referred to as fading. Fading is due primarily to phase changes due to changes in the delays for the different propagation paths. Multi-path fading channels will be studied in detail later in the course. In particular, the impact of multi-path fading on system performance will be investigated. ©2009, B.-P. Paris Wireless Communications 112
  113. 113. Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation Outline Part I: Learning Objectives Elements of a Digital Communications System Digital Modulation Channel Model Receiver MATLAB Simulation ©2009, B.-P. Paris Wireless Communications 113

×