Principles of Communication Systems Simulation with Wireless Applications William H. Tranter K. Sam Shanmugan Theodore S. Rappaport Kurt L. Kosbar PRENTICE HALL Professional Technical Reference Upper Saddle River, New Jersey 07458 www.phptr.com Tranter FM revised 11-18.fm Page 1 Wednesday, November 19, 2003 10:34 AM Library of Congress Cataloging-in-Publication Data Principles of communication systems simulation with wireless applications / William H. Tranter .[et al.] p. cm. – (Prentice Hall communications engineering and emerging technologies series ; 16) Includes bibliographical references and index. ISBN 0-13-494790-8 1. Telecommunication systems–Computer simulation. I. Tranter, William H. II. Series. TK\5102.5.P673 2003 621.382'01'1–dc22 2003063403 Editorial/production supervision: Kerry Reardon Composition: Lori Hughes and TIPS Technical Publishing, Inc. Cover design director: Jerry Votta Cover design: Nina Scuderi Art director: Gail Cocker-Bogusz Manufacturing manager: Alexis Heydt-Long Manufacturing buyer: Maura Zaldivar Publisher: Bernard Goodwin Editorial assistant: Michelle Vincenti Marketing manager: Dan DePasquale Full-service production manager: Anne R. Garcia Prentice Hall PTR offers excellent discounts on this book when ordered in quantity for bulk purchases of special sales. For more information, please contact: U.S. Corporate and Government Sales, 1-800-382-3419, corpsales@pearsontechgroup.com. For sales outside of the U.S., please contact: International Sales, 1-317-581- 3793, international@pearsontechgroup.com Company and product names mentioned herein are the trademarks of their respective owners. MATLAB is a registered trademark of The MathWorks, Inc. for MATLAB product information, please contact: The Mathworks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 USA Tel: 508-647-7000 Fax: 508-647-7101 Email: info@mathworks.com Web: www.mathworks.com All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher. Printed in the United States of America First printing ISBN 0-13-494790-8 Pearson Education LTD. Pearson Education Australia PTY, Limited Pearson Education Singapore, Pte. Ltd. Pearson Education North Asia Ltd. Pearson Education Canada, Ltd. Pearson Education de Mexico, S.A. de C.V. Pearson Education-Japan Pearson Education Malaysia, Pte. Ltd. Copyright © 2004 Pearson Education, Inc. Prentice Hall Professional Technical Reference Upper Saddle River, NJ 07458 Tranter FM revised 11-18.fm Page 2 Wednesday, November 19, 2003 10:34 AM Tranter FM revised 11-18.fm Page 3 Wednesday, November 19, 2003 10:34 AM Dedications To my loving and supportive wife Judy. William H. Tranter To my loving wife Radha. K. Sam Shanmugan To my loving wife, our children, and my former students. Theodore S. Rappaport To my wife and children. Kurt L. Kosbar Tranter FM revised 11-18.fm Page 4 Wednesday, November 19, 2003 10:34 AM “TranterBook” — 2003/11/18 — 14:44 — page v — #1 ✐ ✐ ✐ ✐ ✐ ✐ ✐ ✐ CONTENTS PREFACE xvii Part I Introduction 1 1THEROLEOF SIMULATION 1 1.1 Examples of Complexity 2 1.1.1 The Analytically Tractable System 3 1.1.2 The Analytically Tedious System 5 1.1.3 The Analytically Intractable System 7 1.2 Multidisciplinary Aspects of Simulation 8 1.3 Models 11 1.4 Deterministic and Stochastic Simulations 14 1.4.1 An Example of a Deterministic Simulation 16 1.4.2 An Example of a Stochastic Simulation 17 1.5 The Role of Simulation 19 1.5.1 Link Budget and System-Level Specification Process 20 1.5.2 Implementation and Testing of Key Components 22 1.5.3 Completion of the Hardware Prototype and Validation of the Simulation Model 22 1.5.4 End-of-Life Predictions 22 1.6 Software Packages for Simulation 23 1.7 A Word of Warning 26 1.8 The Use of MATLAB 27 1.9 Outline of the Book 27 1.10 FurtherReading 28 v “TranterBook” — 2003/11/18 — 14:44 — page vi — #2 ✐ ✐ ✐ ✐ ✐ ✐ ✐ ✐ vi Contents 2SIMULATION METHODOLOGY 31 2.1 Introduction 32 2.2 Aspects of Methodology 34 2.2.1 Mapping a Problem into aSimulation Model 34 2.2.2 Modeling of Individual Blocks 41 2.2.3 Random Process Modeling and Simulation 47 2.3 Performance Estimation 49 2.4 Summary 52 2.5 Further Reading 52 2.6 Problems 52 Part II Fundamental Concepts and Techniques 55 3SAMPLINGANDQUANTIZING 55 3.1 Sampling 56 3.1.1 The Lowpass Sampling Theorem 56 3.1.2 Sampling Lowpass Random Signals 61 3.1.3Bandpass Sampling 61 3.2 Quantizing 65 3.3 Reconstruction and Interpolation 71 3.3.1 Ideal Reconstruction 71 3.3.2 Upsampling and Downsampling 72 3.4 The Simulation Sampling Frequency 78 3.4.1 General Development 79 3.4.2 Independent Data Symbols 81 3.4.3 Simulation Sampling Frequency 83 3.5 Summary 87 3.6 Further Reading 89 3.7 References 90 3.8 Problems 90 4LOWPASSSIMULATION MODELS FOR BANDPASS SIGNALS AND SYSTEMS 95 4.1The Lowpass Complex Envelope for Bandpass Signals 95 4.1.1 The Complex Envelope: The Time-Domain View 96 4.1.2 The Complex Envelope: The Frequency-Domain View 108 4.1.3 Derivation of X d (f)andX q (f)from X(f ) 110 4.1.4 Energy and Power 111 “TranterBook” — 2003/11/18 — 14:44 — page vii — #3 ✐ ✐ ✐ ✐ ✐ ✐ ✐ ✐ Contents vii 4.1.5Quadrature Models for Random Bandpass Signals 112 4.1.6 Signal-to-Noise Ratios 115 4.2Linear Bandpass Systems 118 4.2.1 Linear Time-Invariant Systems 118 4.2.2 Derivation of h d (t)andh q (t)fromH(f) 122 4.3 Multicarrier Signals 125 4.4 Nonlinear and Time-Varying Systems 128 4.4.1 Nonlinear Systems 128 4.4.2 Time-Varying Systems 130 4.5 Summary 132 4.6 Further Reading 133 4.7 References 134 4.8 Problems 134 4.9 Appendix A: MATLAB Program QAMDEMO 139 4.9.1 Main Program: c4 qamdemo.m 139 4.9.2 Supporting Routines 140 4.10 Appendix B: Proof of Input-Output Relationship 141 5FILTERMODELSAND SIMULATION TECHNIQUES 143 5.1 Introduction 144 5.2 IIR and FIR Filters 146 5.2.1 IIR Filters 146 5.2.2 FIR Filters 147 5.2.3 Synthesis and Simulation 147 5.3 IIR and FIR Filter Implementations 148 5.3.1 Direct Form II and Transposed Direct Form I I Implementations 148 5.3.2 FIR Filter Implementation 154 5.4 IIR Filters: Synthesis Techniques and Filter Characteristics 155 5.4.1 Impulse-Invariant Filters 155 5.4.2 Step-Invariant Filters 156 5.4.3Bilinear z-Transform Filters 157 5.4.4 Computer-Aided Design of IIR Digital Filters 165 5.4.5 Error Sources in IIR Filters 167 5.5 FIR Filters: Synthesis Techniques and Filter Characteristics 167 5.5.1 Design from the Amplitude Response 170 5.5.2 Design from the Impulse Response 177 5.5.3 Implementation of FIR Filter Simulation Models 180 5.5.4 Computer-Aided Design of FIR Digital Filters 184 “TranterBook” — 2003/11/18 — 14:44 — page viii — #4 ✐ ✐ ✐ ✐ ✐ ✐ ✐ ✐ viii Contents 5.5.5 Comments on FIR Design 186 5.6 Summary 186 5.7 Further Reading 189 5.8 References 189 5.9 Problems 190 5.10 Appendix A: Raised Cosine Pulse Example 192 5.10.1 Main program c5 rcosdemo.m 192 5.10.2 Function file c5 rcos.m 192 5.11 Appendix B: Square Root Raised Cosine Pulse Example 193 5.11.1 Main Program c5 sqrcdemo.m 193 5.11.2 Function file c5 sqrc.m 193 5.12 Appendix C: MATLAB Code and Data for Example 5.11 194 5.12.1 c5 FIRFilterExample.m 195 5.12.2 FIR Filter AMP Delay.m 196 5.12.3 shift ifft.m 198 5.12.4 log psd.m 198 6CASESTUDY:PHASE-LOCKED LOOPS AND DIFFERENTIAL EQUATION METHODS 201 6.1 Basic Phase-Locked Loop Concepts 202 6.1.1 PLL Models 204 6.1.2 The NonlinearPhaseModel 206 6.1.3Nonlinear Model with Complex Input 208 6.1.4 The Linear Model and the Loop Transfer Function 208 6.2 First-Order and Second-Order Loops 210 6.2.1 The First-Order PLL 210 6.2.2 The Second-Order PLL 214 6.3 Case Study: Simulating the PLL 215 6.3.1 The Simulation Architecture 215 6.3.2 The Simulation 216 6.3.3 Simulation Results 219 6.3.4 Error Sources in the Simulation 220 6.4 Solving Differential Equations Using Simulation 223 6.4.1 Simulation Diagrams 224 6.4.2 The PLL Revisited 225 6.5 Summary 230 6.6 Further Reading 231 6.7 References 231 6.8 Problems 232 “TranterBook” — 2003/11/18 — 14:44 — page ix — #5 ✐ ✐ ✐ ✐ ✐ ✐ ✐ ✐ Contents ix 6.9 Appendix A: PLL Simulation Program 236 6.10 Appendix B: Preprocessor for PLL Example Simulation 237 6.11 Appendix C: PLL Postprocessor 238 6.11.1 Main Program 238 6.11.2 Called Routines 239 6.12 Appendix D: MATLAB Code for Example 6.3 241 7GENERATING AND PROCESSING RANDOM SIGNALS 243 7.1 Stationary and Ergodic Processes 244 7.2 Uniform Random Number Generators 248 7.2.1 Linear Congruence 248 7.2.2 Testing Random Number Generators 252 7.2.3 Minimum Standards 256 7.2.4 MATLAB Implementation 257 7.2.5 Seed Numbers and Vectors 258 7.3 Mapping Uniform RVs to an Arbitrary pdf 258 7.3.1 The Inverse Transform Method 259 7.3.2 The Histogram Method 264 7.3.3 Rejection Methods 266 7.4 Generating Uncorrelated Gaussian Random Numbers 269 7.4.1 The Sum of Uniforms Method 270 7.4.2 Mapping a Rayleigh RV to a Gaussian RV 273 7.4.3 The Polar Method 275 7.4.4 MATLAB Implementation 276 7.5 Generating Correlated Gaussian Random Numbers 277 7.5.1 Establishing a Given Correlation Coefficient 277 7.5.2 Establishing an Arbitrary PSD or Autocorrelation Function 278 7.6 Establishing a pdf and a PSD 282 7.7 PN Sequence Generators 283 7.8 Signal Processing 290 7.8.1Input/Output Means 291 7.8.2Input/Output Cross-Correlation 291 7.8.3 Output Autocorrelation Function 292 7.8.4Input/Output Variances 293 7.9 Summary 293 7.10 Further Reading 294 7.11 References 294 7.12 Problems 295 “TranterBook” — 2003/11/18 — 14:44 — page x — #6 ✐ ✐ ✐ ✐ ✐ ✐ ✐ ✐ x Contents 7.13 Appendix A: MATLAB Code for Example 7.11 299 7.14 Main Program: c7 Jakes.m 299 7.14.1 Supporting Routines 300 8POSTPROCESSING 303 8.1 Basic Graphical Techniques 304 8.1.1 A System Example—π/4DQPSKTransmission 304 8.1.2 Waveforms, Eye Diagrams, and Scatter Plots 307 8.2 Estimation 309 8.2.1 Histograms 309 8.2.2 Power Spectral Density Estimation 316 8.2.3 Gain, Delay, and Signal-to-Noise Ratios 323 8.3 Coding 329 8.3.1 Analytic Approach to Block Coding 330 8.3.2 Analytic Approach to Convolutional Coding 333 8.4 Summary 336 8.5 Further Reading 336 8.6 References 338 8.7 Problems 339 8.8 Appendix A: MATLAB Code for Example 8.1 342 8.8.1 Main Program: c8 pi4demo.m 342 8.8.2 Supporting Routines 344 9INTRODUCTIONTOMONTECARLOMETHODS 347 9.1Fundamental Concepts 347 9.1.1 Relative Frequency 348 9.1.2 Unbiased and Consistent Estimators 349 9.1.3 Monte Carlo Estimation 349 9.1.4 The Estimation of π 351 9.2 Application to Communications Systems—The AWGN Channel 354 9.2.1 The Binomial Distribution 355 9.2.2 Two Simple Monte Carlo Simulations 359 9.3 Monte Carlo Integration 366 9.3.1 Basic Concepts 368 9.3.2 Convergence 370 9.3.3Confidence Intervals 371 9.4 Summary 375 9.5 Further Reading 375 9.6 References 375 9.7 Problems 376 . November 19, 2003 10:34 AM Library of Congress Cataloging-in-Publication Data Principles of communication systems simulation with wireless applications / William. Principles of Communication Systems Simulation with Wireless Applications William H. Tranter K. Sam Shanmugan