Network Modeling, Simulation and Analysis in MATLAB Scrivener Publishing 100 Cummings Center, Suite 541J Beverly, MA 01915-6106 Publishers at Scrivener Martin Scrivener (martin@scrivenerpublishing.com) Phillip Carmical (pcarmical@scrivenerpublishing.com) Network Modeling, Simulation and Analysis in MATLAB Theory and Practices Dac-Nhuong Le Haiphong University, Haiphong, Vietnam Abhishek Kumar Pandey ACERC, Visiting faculty, Mdsu, Ajmer Rajasthan, India Sairam Tadepalli AWS Architect, Python Developer, India Pramod Singh Rathore ACERC, Visiting Faculty, Mdsu Ajmer Rajasthan, India Jyotir Moy Chatterjee Lord Buddha Education Foundation (APUTI), Kathmandu, Nepal This edition first published 2019 by John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, USA and Scrivener Publishing LLC, 100 Cummings Center, Suite 541J, Beverly, MA 01915, USA © 2019 Scrivener Publishing LLC For more information about Scrivener publications please visit www.scrivenerpublishing.com. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, except as permitted by law. Advice on how to obtain permission to reuse material from this title is available at http://www.wiley.com/go/permissions. Wiley Global Headquarters 111 River Street, Hoboken, NJ 07030, USA For details of our global editorial offices, customer services, and more information about Wiley products visit us at www.wiley.com. Limit of Liability/Disclaimer of Warranty While the publisher and authors have used their best efforts in preparing this work, they make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives, written sales materials, or promotional statements for this work. The fact that an organization, website, or product is referred to in this work as a citation and/or potential source of further information does not mean that the publisher and authors endorse the information or services the organization, website, or product may provide or recommendations it may make. This work is sold with the understanding that the publisher is not engaged in rendering professional services. The advice and strategies contained herein may not be suitable for your situation. You should consult with a specialist where appropriate. Neither the publisher nor authors shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages. Further, readers should be aware that websites listed in this work may have changed or disappeared between when this work was written and when it is read. Library of Congress Cataloging-in-Publication Data ISBN 978-1-119-63143-9 Cover image: Pixabay.Com Cover design by Russell Richardson Set in size of 11pt and Minion Pro by Manila Typesetting Company, Makati, Philippines Printed in the USA 10 9 8 7 6 5 4 3 2 1 Contents List of Figures xi List of Tables xv Foreword xvii Preface xix Acknowledgments xxi Acronyms xxiii 1 Introduction to Modeling, Simulations and Analysis 1.1 MATLAB Modeling and Simulation 1.2 Computer Networks Performance Modeling and Simulation 1.2.1 Computer-Based Models 1.2.2 Computer Network Simulation 1.3 Discrete-Event Simulation for MATLAB 1.3.1 Terminology and Components of Discrete-Event Simulation 1.3.2 The Principle of Discrete-Event Simulation 1.3.3 ESTA Algorithm 1.3.4 ANALYSIS: Determination of Time to Attain Steady State Condition for MATLAB 1.4 Simulation Software Selection for MATLAB 1.5 Simulation Tools Based on High Performance 1.5.1 Network Model 1.5.2 Network Simulators 1.6 Conclusion References 1 2 4 4 5 6 7 8 9 11 11 12 13 15 22 23 2 Introduction to MATLAB Programming 2.1 Introduction 2.2 Basic Features 2.2.1 Features of MATLAB 2.2.2 Uses of MATLAB 2.3 Notation, Syntax, and Operations 2.3.1 Practical Examples for MATLAB 2.3.2 Use of Semicolon (;) in MATLAB 25 26 27 27 27 27 27 28 v vi Contents 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.3.3 Adding Comments 2.3.4 Commonly Utilized Operators and Special Characters 2.3.5 Unique Variables and Constants 2.3.6 Sparing Process 2.3.7 MATLAB Decisions 2.3.8 MATLAB Loops Import and Export Operations 2.4.1 Import Data in MATLAB 2.4.2 Export Data in MATLAB Elements 2.5.1 Commands 2.5.2 MATLAB Basics 2.5.3 Creating Matrices 2.5.4 Framework Operations 2.5.5 Using M-Files Plotting 2.6.1 Including Various Types of Graphs 2.6.2 Creation of a Multiple Number of Functions in a Similar Graph 2.6.3 Creating a Graph According to Various Colors Uncommon Function Executable Files Generation Calling and Accumulating Executable Documents Calling Objects from External Programs JAVA Classes The Guide 2.12.1 Open a New User Interface 2.12.2 Guide Window Size Setting 2.12.3 Design the User Interface 2.12.4 Adjust the Components 2.12.5 Mark the Push Buttons 2.12.6 Menu Items-Rundown Pop-Up 2.12.7 Static Test Alteration Procedure in MATLAB 2.12.8 Spare the Layout 2.12.9 Behavior of the App 2.12.10 Produce Data to Plot in MATLAB 2.12.11 Pop-Up Menu Characteristics 2.12.12 Behavior of Push Button Effective Programming through MATLAB 2.13.1 Condition 2.13.2 Practice Programs 2.13.3 Specific Functions in MATLAB Clones Process Using MATLAB 2.14.1 GNU Octave 2.14.2 Scilab 2.14.3 Sage 29 29 30 30 30 31 32 32 38 40 40 41 42 42 44 47 48 49 50 51 52 54 55 56 56 57 58 58 59 60 61 61 62 63 63 65 66 67 68 68 69 69 69 70 70 Contents vii 2.15 Parallel MATLAB System 2.15.1 Run a Batch Job 2.15.2 Run a Batch Parallel Loop 2.15.3 Current Folder Browser - Run Script as Batch Job 2.16 Conclusion References 71 71 72 73 74 75 3 Digital Communication System Simulation Using MATLAB 3.1 Introduction to Digital Communication 3.1.1 Data Transmission 3.1.2 Example 3.1.3 The Conversion of Analog and Digital Signals 3.1.4 Information, Bandwidth, and Noise 3.2 Simulation of Rayleigh Fading Model 3.2.1 Rayleigh Fading Basics 3.2.2 Rayleigh Fading 3.3 BPSK Modulation and Demodulation 3.3.1 BPSK Modulation 3.3.2 BPSK Demodulation 3.4 QPSK Modulation and Demodulation 3.4.1 QPSK Transmitter 3.4.2 QPSK Receiver 3.4.3 Performance Simulation over AWGN 3.5 Image Error Rate vs Signal-to-Noise Ratio 3.5.1 M-QAM Modulation 3.5.2 Baseband Rectangular M-QAM Modulator 3.6 Recreation of OFDM Framework 3.6.1 Figuring (Es /N0 ) or (Eb /N0 ) for OFDM Framework 3.6.2 Impact of Cyclic Prefix on Es /N 3.6.3 Effect of Unused Subcarriers on Es/N 3.6.4 Arrangement of Subcarriers 3.6.5 MATLAB Sample Code 3.7 Conclusion References 77 78 78 79 80 82 83 83 84 86 86 87 89 90 93 93 94 94 95 99 101 101 102 103 103 108 109 4 Statistical Analysis of Network Data Using MATLAB 4.1 Introduction to Association Networks 4.2 Time Series, Stationary, Time Series Decomposition, De-trending 4.2.1 Time Series Analysis 4.2.2 Stationarity 4.2.3 Time Series Decomposition 4.2.4 De-trending 4.3 Autocorrelation, Test for Independence, Linear Autoregressive Models 4.3.1 Autocorrelation 4.3.2 ACF and IACF Parameters 4.3.3 Test of Independence 111 112 114 114 115 117 118 124 124 126 128 viii Contents 4.3.4 Linear Autoregressive Models 4.3.5 Linear Prediction and Autoregressive Modeling 4.4 Mutual Information and Test for Independence 4.4.1 Testing the Significance of the Null Hypothesis I(X; Y ) = 0 4.4.2 Producing the Mutual Information Distribution from Surrogates 4.5 Spurious Cross-Correlation, Vector Autoregressive Models and Dynamic Regression Models 4.5.1 Cross Correlation 4.5.2 Vector Autoregression (VAR) Models 4.5.3 Coupled Dynamical Systems 4.6 Conclusion References 135 137 139 139 141 143 143 146 149 150 150 5 Network Routing Simulation Using MATLAB 5.1 Evaluation of Granger Causality Measures on Known Systems 5.1.1 A Historical Viewpoint 5.1.2 Application to Recreated Information 5.1.3 Application to FMRI BOLD Information from a Visuospatial Consideration Undertaking 5.2 Demand Modeling and Performance Measurement 5.2.1 Objectives 5.2.2 Approach to Model Development 5.2.3 Development of Models 5.2.4 Outline of Findings from Phase Two: Model Validation 5.3 Universal Algorithms and Sequential Algorithms 5.3.1 Genetic Algorithm for Improvement Utilizing MATLAB 5.3.2 Masses Diversity-Measure-Run, Prosperity Scaling 5.4 Acoustic-Centric and Radio-Centric Algorithms 5.5 AODV Routing Protocol 5.5.1 Keeping Up Sequence Numbers 5.5.2 Association Breaks 5.5.3 Neighborhood Repairs 5.5.4 Security Considerations 5.6 Conclusion References 155 156 158 164 6 Wireless Network Simulation Using MATLAB 6.1 Radio Propagation for Shadowing Methods 6.1.1 Radio Propagation Modeling 6.1.2 Partition Dependence 6.1.3 Small-Scale Blurring 6.1.4 Free-Space Propagation 6.1.5 Ray Tracing 6.1.6 Indoor Propagation 6.1.7 Classic Empirical Models 6.1.8 COST 231-Hata Model 6.1.9 COST 231-Walfish-Ikegami Model 209 210 210 210 210 211 212 220 221 221 222 170 173 173 174 175 176 178 178 182 190 194 196 196 197 197 203 204 Contents ix 6.1.10 Erceg Model 6.1.11 Multiple Slope Models 6.2 Mobility: Arbitrary Waypoint Demonstrates 6.2.1 Random Waypoint Model 6.2.2 Regular Problems with Random Waypoint Model 6.2.3 Irregular Waypoint on the Border (RWPB) 6.2.4 Markovian Waypoint Model 6.3 PHY: SNR-Based Bundle Catches, Communication, Dynamic Transmission Rate and Power 6.3.1 MAC: IEEE 802.11 6.3.2 IEEE 802.11 RTS/CTS Exchange 6.4 NET: Ad Hoc Routing 6.4.1 Dynamic Destination Sequenced Distance Vector 6.4.2 Wireless Routing Protocol 6.4.3 Global State Routing 6.4.4 Fisheye State Routing 6.4.5 Hierarchical State Routing 6.4.6 Zone-Based Hierarchical Link State Routing Protocol 6.4.7 Clusterhead Gateway Switch Routing Protocol 6.4.8 Cluster-Based Routing Protocols 6.4.9 Ad Hoc On-Demand Distance Vector Routing 6.4.10 Dynamic Source Routing Protocol 6.4.11 Temporally Ordered Routing Algorithm 6.4.12 Associativity-based Routing 6.4.13 Signal Stability Routing 6.5 APP: Overlay Routing Protocols 6.5.1 System/Application Designs, Optimizations, and Implementations on Overlay Networks 6.5.2 Routing Overlays for VoIP 6.5.3 Measurement, Modeling, and Improvement of BitTorrent Overlays 6.6 Conclusion References 7 Mobility Modeling for Vehicular Communication Networks Using MATLAB 7.1 Vehicle Network Toolbox 7.1.1 Transmit and Receive CAN Messages 7.1.2 Examine Received Messages 7.1.3 CAN Message Reception Callback Function 7.2 Network Management (NM) 7.2.1 Plan Your Network Installation 7.2.2 Planning Your Network Installation 7.2.3 Setting Up a Remote Client Access Configuration 7.2.4 Setting Up Local Client Access Configuration 7.3 Interaction Layer 7.3.1 Directing Protocols in MANET 7.3.2 Specially Appointed On-Demand Distance Vector 224 225 234 234 235 235 235 235 236 237 238 240 243 243 244 244 245 246 247 248 249 250 252 253 254 254 255 256 259 260 267 268 268 271 272 274 274 275 275 275 277 278 278 x Contents 7.3.3 Dynamic Source Routing (DSR) 7.3.4 Diagram of Mobility Model 7.3.5 Results and Analysis 7.3.6 Association Variation Results 7.4 Transport Protocols 7.4.1 TCP Transport Protocol 7.4.2 User Datagram Protocol, or UDP 7.4.3 Reliable Data Protocol, or RDP 7.4.4 Transmission Control Protocol, or TCP 7.5 Conclusion References 8 Case Studies and Sample Codes 8.1 Case Determination and Structure 8.1.1 Exhibiting Analysis 8.1.2 Case Example 8.1.3 The Best Strategy 8.1.4 Impediment of the Technique 8.1.5 Sorts of Contextual Investigations 8.1.6 Relevant Examinations in Business 8.1.7 Summing Up from Logical Investigations 8.1.8 History 8.1.9 Related Vocations 8.2 Case Study 1: Gas Online 8.2.1 Load Data into Project 8.2.2 Construct Boundary Models 8.3 Case Study 2 8.3.1 Case 1: Create a Credit Scorecard Dissent 8.3.2 Case 2: Binning Information 8.4 Case Study 3: Random Waypoint Mobility Model 8.5 Case Study 4: Node localization in Wireless Sensor Network 8.6 Case Study 5: LEACH Routing Protocol for a WSN 8.7 Conclusion References 278 279 280 282 285 285 286 286 286 287 288 291 292 293 293 293 293 294 294 294 295 295 296 296 296 302 302 304 306 312 325 334 334 List of Figures 1.1 1.2 1.3 1.4 1.5 1.6 1.7 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 System modeling and simulation scheme. Network simulator abstraction. Discrete-event simulation. Principles of discrete-event simulation and the system state changes only at discrete point’s ti in time during the simulation. Flow chart explaining a discrete-event test system. Wireless sensor network model. Tier-based node model. MathWorks MATLAB R2018b MATLAB decision. MATLAB loops. MATLAB elements. Create an M-File. How to add new toolbox to MATLAB. Initializing deploy tool in MATLAB. Initializing standalone application. Initilazing toolboxes required. Inspecting MATLAB GUI. Simple GUI. Selecting callback options. Selecting callback options 2. Running script as batch job. Data transmission system. Time domain and frequency domain representation of a signal. Analog-to-digital conversion. Upper panel: Periodic sampling of an analog signal. Bottom panel: Quantization of a sampled signal. Simulation results. BPSK modulator. BPSK demodulator. Sampling and results. Waveform simulation model for QPSK modulation. Timing diagram for BPSK and QPSK modulations. Waveform simulation model for QPSK demodulation. Simulated QPSK waveforms at the transmitter side. M-QAM modulator. 5 6 7 8 10 13 14 26 30 31 41 45 47 53 53 54 63 65 65 67 74 78 79 81 81 85 86 87 89 90 92 93 94 95 xi xii 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 List of Figures M-QAM simulation model. Samples of in-phase component. An OFDM communication architecture with a cyclic prefix. Effect of cyclic prefix on Es /N0 . Assignment of OFDM subcarriers. Eb /N0 Vs BER for BPSKOFDM over AWGN. OFDM essential Tx-Rx chain. 108 BER results. Flowchart of association rules implementation. (a) ARN for contact lens data with target node as hard; (b) ARN for contact lens data with target node as soft. Schematic diagram showing the activity method of communication in a software with ARN. Time series plot for adjusted AUTOSALE/CPI. Time series chart with obtained output form. Output of wave configeration. Error rates identification. Density estimate for power spectral. Density estimate for periodogram spectral. Plottings of the estimate. Markov plottings. Parameters of new functions. Replot status. VAR models. Each middle purpose of the structure is related to a signal. Edges between focus remain for reliance (shared data) between the signs. Basic driving cases that can incite fake unmistakable check of huge Granger causality. Granger causality patterns between simulated ROIs. Comparison of model estimation by LASSO-GC and pairwise GC. Correlation of LASSO-GC and pairwise-GC techniques in recouping the summary measurement. Correlation of LASSO-GC and pairwise-GC techniques in recuperating the W summary measurement. Examination of network designs with LASSO-GC and connection measures. Utilitarian availability examination of dorsal attention network and visual occipital cortex in visualspatial consideration. Different phases of approach in attributes. GAs in MATLAB’s Optimization Toolbox. Rastrigin’s function optimization with the default setting. Rastrigin’s function optimization with the default setting, except Stopping Criteria-Stall Generations set 100 and initial range set [1; 1.1]. Rastrigin’s function optimization with the default setting, except Stopping Criteria-Stall Generations set 100 and initial range set [1; 1.1]. Rastrigin’s function optimization with the default setting, except Stopping Criteria-Stall Generations set 100 and initial range set [1; 2]. 96 98 99 101 103 107 108 112 113 113 116 117 125 130 137 138 140 142 144 145 146 156 162 166 167 169 170 171 173 177 180 181 182 183 183 List of Figures 5.15 5.16 5.17 5.18 5.19 5.20 5.21 5.22 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 6.14 6.15 6.16 6.17 6.18 6.19 6.20 6.21 6.22 6.23 6.24 6.25 6.26 Lower raw fitness value. Higher raw fitness value. Stochastic uniform selection method. Elite count 10. Elite count 3. Elite count 1. Estimation of frequency relation to error over time. Radiation readings for distributed beamforming. Spherical free-space propagation: power transmitted over the air radiates spherically, with different gain in different directions. A portion of that power is received on an active aperture area Ae of the receiving antenna. Ray model geometry. Simple propagation models: free-space one-slope direct line of sight, and two-ray with direct ray and ground reflected ray. In some places, signal adds constructively, in others phase differences cause deep fades. Vertical polarization ground reflection coefficient. Horizontal polarization ground reflection coefficient. Six-ray model (R0;R1;R2) and ten-ray model (R0 to R4) geometry: each line hides two rays, one direct, the other bouncing off the ground. Ray tracing plots of received signal power indicator 20log|Σi=N i=0 pi| as a function of log d0 for N {0, 2, 3, 5} for a typical suburban case with street width of 20 feet, and the average distance from the street to the home of wt = 10 feet (so ws = 40 feet). Ray-tracing geometry for a street corridor; some rays escape the corridor through gaps between homes. Ray-tracing power levels down a street, with gaps between homes. 219 Beam following impinging on home dividers. Angles of incidence illuminating homes in an urban corridor. Demonstration of street orientation angle φ for use in COST 231 WalfishIkegami model. Tree foliage attenuation as a function of frequency. COST-231 indoor penetration loss model. Penetration odd into private structures, total thickness dispersion. In-building loss for residential buildings: measurement campaigns published for different frequencies, in different residential areas. In-building loss for urban office buildings and high-rises: measurement campaigns published for different frequencies, in different urban areas. Random waypoint model. MAC layers in IEEE 802.11 standard. RTS/CTS mechanism. Ad hoc routing protocols. Example of distance vector routing. Accuracy of information in FSR. An example of clustering in HSR. Example of CGSR routing from node 1 to node 12. Example of CBRP protocol. xiii 184 185 185 186 186 187 193 194 211 213 214 215 216 217 218 218 219 220 223 226 230 231 232 232 234 236 237 239 240 244 245 246 247 xiv 6.27 6.28 6.29 6.30 6.31 6.32 6.33 6.34 6.35 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 8.11 8.12 8.13 8.14 8.15 List of Figures Route discovery in AODV. Creation of record route in DSRP. Example of route creation in TORA. Re-establishing route on failure of link 5-7. The new reference level is node 5. Associativity-based routing. An illustrative example of overlay networks. A sample overlay network. Overlay network broken up into logical layers. Overlay network over the Internet. Timestamp identification. Execute the callback function. Remote client access configuration setup. Local client access configuration setup. PDR vs Node Mobility. Packet Loss Rate vs Node Mobility. Routing Overhead vs Node Mobility. Average End-to-End Delay vs Node Mobility. Packet Delivery Ratio vs Number of Connections. Routing Overhead vs Number of Connections. Packet Loss Rate vs Number of Connections. Average End-to-End Delay vs Number of Connections. Two-stage model of torque against spark. ResStatus plot. CustIncome plot. CustIncome plot. TmAtAddress plot. ResStatus plot. EmpStatus plot. Random waypoint mobility model. The location of target and anchor nodes in WSN. (a) Simulated path loss model; (b) Histogram of simulated RSS noise modeled as Gaussian mixture. RMSE vs N (number of anchors). CDF vs error. Cluster formation in LEACH. Steady-state phase in LEACH. LEACH simulation. 248 249 251 251 252 255 257 257 258 271 273 275 276 280 281 281 282 282 283 283 284 301 303 304 305 305 305 306 306 313 324 324 325 325 327 333 List of Tables 1.1 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 4.1 4.2 4.3 5.1 5.2 5.3 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.12 6.13 7.1 Summary of the most important network simulators. Operators and special characters. Unique variables and constants. Variables and constants. Articulations. Loop control statements. Low-level file I/O functions. Framework operations. Setting colors. Calling objects functions. Java class functions. MeansRT and error rates under each condition. Relations between different networks and test sessions. Techniques related to VARM. The fraction of non-zero coefficients in each of the 4 submatrices. 165 Methodologies related to operations. Filtering mechanisms for different models in structural problems. 191 Relative permittivity. Values for COST 231 Hata and modified Hata models. Values of a(hM ) for COST 231 Hata model according to city size. 221 Values of CM for COST 231 Hata model according to city size. Values for COST 231 Walfish-Ikegami model. Values for Erceg model. Values for Erceg model parameters in various terrain categories. Vegetation loss caused by tree foliage reported for various frequencies: single-tree model loss in dB, and dB/m loss. TGn channel models A to F are used to model MIMO systems in a different environment, with different RMS delay spreads. TGn channel models A to F use two slopes n1 = 2 near transmitter and different values of n2 beyond a critical distance d0 . 228 Building penetration loss from COST-231 model. Private structures penetration loss: middle odd (μi ) and standard deviation (σi ) from exploratory outcomes announced for different frequencies. Penetration loss into vehicles: median loss (μv ) and standard deviation (σv ) from experimental results reported at various frequencies. Parameter values in simulation. 15 29 30 31 32 32 35 42 50 55 56 131 132 147 189 216 221 222 223 224 224 226 228 230 231 233 279 xv Foreword In addition to modeling and simulating systems, this book provides a better understanding of how real-world systems function. This enables us to predict the behavior of systems before they are actually built and to accurately analyze them under various operating conditions. This book provides comprehensive, state-of-the-art coverage of all the essential aspects of modeling and simulation both physical and conceptual systems. Various real-life examples are included, which show how simulation plays a crucial role in understanding real-world systems. We also explain how to effectively use MATLAB to apply the modeling and simulation techniques presented successfully. After introducing the underlying philosophy of the systems, the book offers step-bystep procedures for modeling with practical examples, and codes different types of systems using modeling techniques such as the Rayleigh fading model, BPSK modulation and demodulation, QPSK modulation and demodulation, etc. This book will prepare both undergraduate and graduate students for advanced modeling and simulation courses, and will help them carry out useful simulation studies. Moreover, postgraduate students should be able to comprehend and conduct simulation research after completing this book. xvii Preface This book is organized into eight chapters. In Chapter 1 a detailed overview is provided on how MATLAB can be used for network simulation and modeling. Then various types of simulation are described, followed by their working principles and different terminologies, along with the algorithms governing these simulations. The chapter also describes the selection of various software simulations for MATLAB, and the simulation tools based on high performance, followed by the different network models. This chapter will effectively help readers understand the concepts more clearly and provide them with a clear understanding of how to perform these tasks in MATLAB. In Chapter 2, the power of MATLAB for computational mathematics is shown, followed by a detailed description of the features. A detailed discussion of various areas of MATLAB use is provided. We also discuss multiple notations, operators, and syntax and give hands-on practical examples along with various loop structures and decision controls, import, and export operations, using and creating M-files, different types of plotting and graphs, etc. Also explained are the various clones of MATLAB. This chapter will effectively help readers understand the workings and uses as well as applications of MATLAB more clearly. In Chapter 3, we explain how digital communication system simulations can be performed using MATLAB. A detailed introduction to digital communications, i.e, data transmission, is provided along with an example. Next, a detailed explanation of simulations of Rayleigh fading model, BPSK modulation and demodulation, QPSK (Quadrature Phase Shift Keying) modulation and demodulation is given, along with their MATLAB coding, and the output is shown as well. We image error rate vs signal-to-noise ratio and OFDM with sample MATLAB coding and their output. In Chapter 4, we explain how to perform statistical analysis of network data utilizing MATLAB starting from affiliation systems/networks with examples. Time series analysis, statistical stationarity, time series decomposition, de-trending, curve fitting, digital filtering, recurrence reaction, and the connection between recurrence reaction to spline parameter are also explained. Next, details are provided about autocorrelation, test for independence, linear autoregressive models, etc. In Chapter 5, we explain how network routing simulations can be done using MATLAB. Additionally, deep insights are provided about the evaluation of Granger causality measures on known systems, along with results. We explain the application to fMRI BOLD (BloodOxygenation-Level-Dependent) information from a visuospatial consideration undertaking followed by various model development approaches, models validation, universal algorithms, and sequential algorithms, acoustic-centric and radio-centric algorithms, AODV routing protocols, etc. xix xx Preface In Chapter 6, we explain how wireless network simulations can be done using MATLAB. We explain how shadowing methods are used for radio propagation, two-ray model, indoor propagation, classical empirical model, Hata model, Walfisch-Ikegami model, Erceg model, multi-slope model, dispersive model, 3GPP SCM, MAC: IEEE 802.11 (CSMA/CA, virtual carrier sense, and RTS-CTS-DATA-ACK), NET-ad hoc routing, APP-overlay routing protocols, etc. In Chapter 7, we explain various layers and protocols such as Vehicle Network Toolbox. In this toolbox, an explanation is given on how to make a receiving channel, how to access a chain, how to start a channel, how to transmit a message, etc. Next, the topic of network management (NM) is presented, in which a detailed explanation is given of network installation planning, setting up a remote client access configuration, interaction layer, directing protocols in MANET, along with their results and analysis, and transport layer with protocols. In Chapter 8, a detailed explanation is provided of various real-time scenarios by using case studies taken from multiple real-time situations with their sample codes and result from analysis for a better understanding of how MATLAB performed in these situations and how it can solve critical simulation problems in detail. Dr. Dac-Nhuong Le Deputy-Head, Faculty of Information Technology Haiphong University, Haiphong, Vietnam Abhishek K. Pandey Assistant Professor (Computer Science Engineering) ACERC, Visiting faculty, Mdsu, Ajmer Rajasthan, India Sairam Tadepalli Junior Data Scientist, AWS Architect, Python Developer Pramod Singh Rathore Assistant Professor (Computer Science Engineering) ACERC, Visiting faculty, Mdsu Ajmer Rajasthan, India Jyotir Moy Chatterjee Assistant Professor (IT) Lord Buddha Education Foundation (APUTI), Kathmandu, Nepal Acknowledgments First of all, I would like to thank the authors for contributing their chapters to this book. Without their contributions, this book would not have been possible. Thanks to all my associates for sharing my happiness at the start of this project and following up with their encouragement when it seemed to be too difficult to complete. I want to acknowledge and thank the most important people in my life, my grandfather, grandmother, and finally thanks to my wife. This book has been a long-cherished dream of mine which would not have been turned into reality without the support and love of these fantastic people, who encouraged me despite my not giving them the proper time and attention. I am also grateful to my best associates for their blessings and unconditional love, patience, and encouragement. Dac-Nhuong Le Deputy-Head, Faculty of Information Technology Haiphong University, Haiphong, Vietnam Writing a book is harder than I thought and more rewarding than I could have ever imagined. First and foremost, I would like to thank my father Mr. Krishan Dev Pandey for being the coolest father ever and my mother Mrs. Veena Pandey for allowing me to follow my ambitions throughout my childhood. They taught me discipline, tough love, manners, respect, and so much more that has helped me succeed in life. Also, I would like to express my gratitude to my elder sister Mrs. Arpna Tripathi, who always stood by me during every struggle and all my successes. She has been my inspiration and motivation for continuing to improve my knowledge and move my career forward. Also, I’m eternally grateful to my wife, Mrs. Kajal Pandey, for standing beside me throughout my career and the writing of this book. I also thank my wonderful son, Aarudra Pandey, for always making me smile and for understanding on those weekend mornings when I was writing this book instead of playing games with him. I hope that one day he can read it and understand why I spent so much time in front of my computer. Last but not the least, I want to thank my friends who always backed me up during both good and bad days and everyone who ever said anything positive to me or taught me something. I heard it all, and it meant something. Abhishek K. Pandey Assistant Professor (Computer Science Engineering) ACERC, Visiting faculty, Mdsu, Ajmer Rajasthan, India. xxi Acronyms AAL ABR ACK AODV ASK ANT ASW ARIMA AR AS ASAP B.A.T.M.A.N BPSK BOLD CDF CSMA/CA CSMA/CD CLPC CTS CRLB CBRP CGSR DSR DAN DREAM DSSS DSDV DSRP DRP DHT ECG EEG FMRI FEF FHSS FFT Ambient Assistive Learning Associativity Based Routing Acknowledgement Ad hoc On-Demand Distance Vector Amplitude-Shift Keying Attention Network Test Apparent Source Width Autoregressive Integrated-Moving-Average Auto Regressive Autonomous System AS-Aware Peer-relay Protocol Better Approach To Mobile Adhoc Networking Double Phase Shift Keying Blood-Oxygenation-Level-Dependent Cumulative Distribution Function Carrier-Sense Multiple Access with Collision Avoidance Carrier Sense Multiple Access with Collision Detect Cross-Layer setup approach for Power Control Clear to Send Cramer-Rao Lower Bound Cluster based Routing Protocol Clusterhead Gateway Switch Routing Dynamic Source Routing Dorsal Attention Network Distance Routing Effect Algorithm for Mobility Direct Sequence Spread Spectrum Destination-Sequenced Distance-Vector Routing Dynamic Source Routing Protocol Dynamic Routing Protocol Distributed Hash Table Electrocardiogram Electroencephalogram Functional Magnetic Resonance Imaging Frontal Eye Field Frequency Hopping Spread Spectrum Fast Fourier Transform xxiii xxiv Acronyms FSR GC GA GM-SDP GUI GSR IACF IEEE ITU-T JiST LASSO LEACH LOS LCC LUT M-QAM MWP MANET MVAR MIMO MWP MRL MUEL NM NS NHST NLOS OFDM OLSR OS OMNET PAN PHY P2P PLL PSK PROWLER QPSK QAM RWPB RWP RWPB RERR RREP RPGM RDP Fisheye State Routing Granger Causality Genetic Algorithm Gaussian Mixture-SemiDefinite Programming Graphical User Interface Global State Routing Interaural Cross correlation Function Institute of Electrical and Electronics Engineers International Telecommunication Union-Telecommunication Java in Simulation Time Least Absolute Shrinkage and Selection Operator Low Energy Adaptive Clustering Hierarchy Line of Sight Least Cluster Change Look-Up-Table M-ary Quadrature Amplitude Modulation Markovian Waypoint Model Mobile Ad-hoc Network Multivariate Vector Auto Regressive Multiple In, Multiple Out Markovian Waypoint Model Message Retransmission List Minimize Usage Extend Life Network Management Network Simulator Null Hypothesis Significance Testing Non Line of Sight Orthogonal Frequency Division Modulation Optimized Link State Routing Protocol Operating System Object-Oriented Modular Discrete Event Simulator Personal Area Network Physical Layer Peer-to-Peer Phase Locked Loop Phase-Shift Keying Probabilistic Wireless Network Simulator Quadrature Phase Shift Keying Quadrature Amplitude Modulation Irregular Waypoint on the Border Arbitrary Waypoint Discretionary Waypoint on the Periphery Route Error Route Reply Reference Point Group Mobility Model Reliable Data Protocol Acronyms xxv ROI RON RTS RREQ RT RFC RSS RMSE SSR SSF SNAP SST SRP SCM SDP SNR SwaP SWANS TORA TCP TCP/IP TTL TOSSIM TDMA UDP VAR VANET VOC VPN VoIP ZRP ZHLS WRP WLS WSN WOE WIMAX 3GPP Region of Interest Solid Overlay Networks Request to Send Route Request Response Time Request for Comments Received Signal Strength Root Mean Square Error Signal Stability Routing Scalable Simulation Framework Simulation Analysis Platform Signal Stability Table Static Routing Protocol Spatial Channel Model Semidefinite Programming Signal-to-Noise Ratio Weight and Power Scalable Wireless Ad hoc Network Simulator Temporally Ordered Routing Algorithm Transmission Control Protocol Transmission Control Protocol/Internet Protocol Time to Live Tiny Operating System Sensor Network Time Division Multiple Access User Datagram Protocol Vector Autoregression Vehicular Ad hoc Network Visual Occipital Cortex Virtual Private Network Voice over Internet Protocol Zone Routing Protocol Zone-based Hierarchical Link State Routing Protocol Wireless Routing Protocol Weighed Least Square Wireless Sensor Network Weight of Evidence Worldwide Interoperability for Microwave Access 3rd Generation Partnership Project CHAPTER 1 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS Abstract In this chapter, we have tried to provide a detailed overview of how MATLAB can be used for network simulation and modeling. We describe simulation and its various types, followed by their working principles and different terminologies, and the algorithms governing these simulations. Also described are various simulation software selections for MATLAB, the simulation tools based on high performance, followed by the different network models. This chapter will effectively help readers understand the concepts more clearly and provide them with a clear understanding of how to perform these tasks in MATLAB. Keywords: MATLAB, modeling, simulations Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 1 2 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS 1.1 MATLAB Modeling and Simulation The representation of the system in learning is an abstraction, as mentioned previously. This means that it will not generally be considered with a more significant number of features as well as characteristics of the system and also that it only produces elected features and characteristics. Hence, based on simplifications and assumptions, the received model representation is a compact enactment of the system. Learning the sequence for identifying the appropriate entities and their relationships with the system is known as modeling. Two important questions arise for any researcher when dealing with the evaluation of the performance of the system: Question 1 - What is a good model? Question 2 - How to obtain it? Here it is essential to take care of two additional factors if the evaluation method is represented as the computer simulation. (i) It has to be implemented in software once the performance model is built. Hence, the “model” performance is to be of high quality, as the implementation needs to represent it. (ii) Hence, a suitable tool requirement needs to be selected which formally suits the process of the evaluation method. The modeling for computer simulations of these four cornerstones are combined. Sadly, the problem is that a large number of them are complex, and generally, we need specific prior learning experience with modeling and simulation. “Essentially, all models aren’t right, yet some are helpful” is the reality of execution. By remembering this, a great execution (either for investigation or for reenactment) has the following qualities: Simplicity: It is conceivable that the execution models are great. This does not imply that an execution model ought not be point by point or ought not to attempt to consider complex connections. In any case, a great execution displays its multifaceted nature when it fills the need of the assessment (additionally alluded to as objective of the investigation). Because of the shortage of exactness in contrast with the real world, this is a fundamental point in reproduction models which are regularly scrutinized. This is basically the notion od computer simulation and manufactured the rganized nodes so that mixing of nodes can be minimized to get better accuracy. For the reusability of execution models, it has certain additional results. Usually, the assessment contemplates have different objectives (primarily if they will be distributed to established researchers), so there is likely a contrast in the utilized execution models. For systems, it clarifies a large number of open-source reproduction models, and for across-the-board organizing frameworks, it explains the nonattendance of prevailing or standard reenactment models to a certain degree. To fill all needs, there MATLAB MODELING AND SIMULATION 3 is no reenactment shown. Any recreation demonstrate which is accessible has been planned given a specific assessment target. One should first check the first assessment reason which is served by the model, and it needs to reuse the particular reproduction display. Reliability: The basic part of execution models is their stable quality. The clarification behind the evaluation of modeling has been made clear initially for better efficiency. In the resulting phase of the modeling system, the assumptions and reenactments ought to have been noticed, including its evolution phases. From the learning phases of the model to final output phase, model representation and its simulation plays an important role in finding the reliability of the resultant model. In the simulation part of the modeling, the recreation of the model is very much important for better analysis of the model. The analysis result states that there difference between evaluation procedure and final output and its application model. So reliability factor has to deal with all the above-mentioned analysis. So a genuine programming model can only result in better reliability of the system, as it is reliable for better execution, evaluation and final applications. Notwithstanding the qualities of a decent execution display, a great reproduction model ought to have the accompanying attributes: Proficiency: As for the execution show up, it ought to be finished reasonably after a particular instant of time. In like way, running events of simulation is quick and different analysis results can then be visible. Checked: The executed reenactment model ought to be confirmed, i.e., the similarity between the execution shown and reproduction demonstrate that it more likely than not has been checked by different strategies. Note that this progression is not quite the same as approving an execution or reproduction display. Code Quality: Reliability on reusability of the code can result in using a specific programming method which is responsible for avoiding confusion in system programming and further simulation for achieving the desired results. Accessibility: Reproduction model ought to be available with the end goal that different gatherings confirm and approve the model themselves. As expressed previously, an execution show isn’t required to be as point by point as could reasonably be expected. Truth be told, finding the correct level of exactness for an execution show is very troublesome. A typical oversight in demonstrating is to put excessive detail into a model because of the need for both involvement in execution assessment or foundation information about the framework under investigation. Lastly, a great execution does not need to be all inclusive nor for the most part reusable. 4 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS 1.2 Computer Networks Performance Modeling and Simulation 1.2.1 Computer-Based Models Computer-based models are usually classified as follows [1, 2]: Deterministic vs Stochastic: A deterministic model predicts a specific output from a given set of inputs with neither randomness nor probabilistic components. A given input will always produce the same output given the same initial conditions. In contrast, a stochastic model has some inputs with randomness, hence the model predicts a set of possible outputs weighted by their likelihoods or probabilities. Steady-state vs Dynamic: A steady-state model tries to establish the outputs according to the given set of inputs when the system has reached steady-state equilibrium. In contrast, a dynamic model provides the system reactions facing variable inputs. Steady-state approaches are often used to provide a simplified preliminary model. Discrete vs. Continuous values: A discrete model is represented by a finite codomain, hence the state variables take their values from a countable set of values. In contrast, a continuous model corresponds to an infinite codomain. Therefore, the state variables can take any value within the range of two values. However, there are some systems that need to be modeled showing aspects of both approaches which bring about combined discrete-continuous models. Discrete vs Continuous time: In a discrete model the state changes can only occur at a specific instant in time. These instants correspond to significant events that impact the output or internal state of the system. In contrast, in a continuous model the state variables change in a continuous way and not abruptly from one state to another. Therefore, continuous models encompass an infinite number of states. Discrete models are the most commonly used for network modeling and simulation. Simulations can be carried out following two approaches: local and distributed. Distributed simulation is such that multiple systems are interconnected to work together, interacting with each other, to conduct the simulation. In contrast, a local simulation is carried out on a single computer. Historically, the latter approach has been the most widely used to simulate computer networks, but the increasing complexity of simulations is fostering the importance of the former approach. Figure 1.1 summarizes the modeling and simulation process. Behavioral information extracted from a real system is used jointly with system specifications and requirements. Based on these inputs, a system model is built and subsequently validated through simulation. Usually, several performance metrics are determined during simulations, which can be compared with results extracted from experimentations with the real system. If both are similar, the model is considered as valid, while if they are not, the system model must be corrected. Similarly, performance metrics COMPUTER NETWORKS PERFORMANCE MODELING AND SIMULATION 5 are used to determine if the system model fulfills the requirements, so the designed system can be refined and extended in a controlled way. Figure 1.1 1.2.2 System modeling and simulation scheme. Computer Network Simulation Nowadays, computer network simulation is a fundamental element in network researching, development and teaching. Network simulators are widely used not only by practitioners and researchers, but also by students to improve their understanding of computer networks. Network simulation can be extremely useful when applied to scenarios such as protocol analysis, complex network deployment, evaluation of new services, prototypes or architectures, and so on. Broadly speaking, a network simulator can be understood as a black box, as illustrated in Figure 1.2 [13, 23, 24] A network simulator implements a computer network model through algorithms, procedures and structures according to a given programming language. The implemented network model receives a set of parameters as inputs, which impose the rules and constraints of the simulation. In other words, these parameters set the course of the simulation. When the simulation process ends, the network simulator returns a set of results as outputs that can be used with a dual purpose: validating and veri- 6 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS fying the correctness of the implemented model for a particular domain of system states, and analyzing the behavior of the network modeled when the former has been successful [15-17]. Figure 1.2 Network simulator abstraction. Computer networks are most often simulated with discrete-event simulation. The main reason behind this widespread use is that discrete-event simulation adapts better to represent the behavior of computer networks, since computer network protocols can be modeled as finite state machines. In a computer network there is a steady state between two consecutive events, and discrete-event simulation allows for jumping from one steady state to another, leading to faster simulations. Other interesting aspects of discrete-event simulation are flexibility and lower computational overhead. 1.3 Discrete-Event Simulation for MATLAB Discrete event simulation utilizes a mathematical/logical model of a physical system that portrays state changes at precise points in simulated time. Both the nature of the state change and the time at which the change occurs mandate precise description. Customers waiting for service, the management of parts inventory or military combat are typical domains of discrete event simulation [10, 11]. A more theoretical top-down description of discrete-event simulations is the following: The start of a discrete-event simulation is a model. A model is the construction of a conceptual framework, used to represent a system. The specific characteristics of discrete-event simulation model are the following: 1. Stochastic: At least some of the model’s components are stochastic. This means that there is a certain factor of randomness in the model. This is represented by random number generators, which are explained in the terminology. 2. Dynamic: The time evolution of the system’s components is important. Time is a significant variable. 3. Discrete: The state of the system changes only significantly when events occur at discrete time instances. DISCRETE-EVENT SIMULATION FOR MATLAB Figure 1.3 7 Discrete-event simulation. The difference with continuous simulations is the use of the factor time. The system evolves over time so the variables change continuously in a continuous simulation. Whereas in a discrete event simulation the events themselves determine if something happens or not. Time can go by without anything happening. We will give a concise introduction into discrete-occasion reenactment and for this we present the essential phrasing utilized in writing to clarify their connections. Likewise, for a discrete-occasion test system we present the center calculation, i.e., the time-propel occasion booking calculation. 1.3.1 Terminology and Components of Discrete-Event Simulation Some common phrasing and elements for all discrete-occasion reproduction frameworks are known. In writing the terminology may change and surprisingly there is no institutionalized arrangement of terms. In a portion of our reference papers we freely adjust the definitions. A reflection of a specific subject of intrigue is alluded to as substance and it very well may be depicted by its own properties; For example, an element bundle carries its source (address), qualities, length as well as goal (address). The relationship of a suitable set of entities is defined as a system. A certain purpose can be fulfilled by the relationship of a suitable set of entities, i.e., the system attempts to achieve a certain goal. For example, the goal of a network provides endto-end connectivity while it may be defined by the routers, links and the entities hosts. The model is defined as the system and the use of the following methods refers to an abstracted system and is termed the model for clearness. During the process of minimizing the difficulty and the correlated cost as well as, effort involved, it will always consider the model in computer simulations. 8 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS 1.3.2 The Principle of Discrete-Event Simulation It is possible to utilize the discrete-event test system to bounce from one event to the next, and the rate an occasion might incite can be modified in the state of framework and also the age of a newer, supposed event occurred in future. To deal with every one of the events in the discrete-event simulation, the events are recorded as events seen later on the event list (FEL). To embed, to discover and to evacuate events seen, which are set later on, an event rundown ought to be actualized effectively later on in the event list [25]. Figure 1.4 demonstrates the growth of discrete-event simulation after some time. The events happen at the given time interval ti and might alter the state of framework. To advance the reenactment with each discrete-event time ti , in the PC memory a depiction of the framework is made that contains every required datum. Figure 1.4 Principles of discrete-event simulation and the system state changes only at discrete point’s ti in time during the simulation. Typically all discrete-event test systems share the following components: System express: The condition of the framework can be depicted by the arrangement of factors. Entities: Temporary entities are the elements that flow through the system. They wait in queues, follow a sequence of events and are specified by certain attributes. Most entities are introduced in a system according to a stochastic distribution. Examples of temporary entities are: parts of goods, customers and information messages. Permanent entities remain in the system when the simulation is executed. They are used in the events to process the temporary entities. The usage time of permanent entities is mostly stochastically distributed. Examples of permanent entities are: operators, servers and machines. Attributes: Entities own attributes that specify certain properties and states of the entity. They can affect how entities are handled during the sequence of the processes. They are not fixed through the flow so they can change by being processed. Examples of attributes are: priority and quality. Clock: The clock maintains the simulation time. The measurement units vary depending on the characteristics of the model. Because we are dealing with discrete-events, the time is not continuous but “jump” according to the events. The clock is also responsible for the timer of the events. DISCRETE-EVENT SIMULATION FOR MATLAB 9 Queue: Place where temporary entities wait an undetermined time before being accepted in an event. Some entities might have priority attributes to skip the queue. These queues can, for example, be used to locate overproduction or a bottleneck, as mentioned in the introduction. Random number generators: Most of the previous components need the possibility to generate random variables in order to simulate the stochastic distributions. Pseudorandom number generators are used to accomplish this. Future occasion list: To deal with the events, it very well may be appropriated by the information structure. Statistical counters: The result of a simulation should be shown in the form of a report that gives statistics about all the important components of the discreteevent simulation. These statistics are analyzed to make better decisions. Initialization schedule: To instate the reproduction display we utilize introduction routine and fix the clock value to zero in the framework. Timing schedule: From the future event list a routine recovers the the next occasion and also advances the clock value to the frequency in the framework. Event schedule: Events change the state of the system. A sequence of events can be bundled as an activity. These events determine the timing and the flow of the simulation, hence the word discrete-event simulation. A typical example of an event is the arrival of new entity, often used to start the simulation. The sequence of events ordered by time of occurrence forms an event list. Each simulation has at least one event list. This events list determines the mechanism for advancing the simulation time. This sequence of actions is also called eventscheduling. Every simulation also needs a stopping event or ending condition. This determines how long the simulation will run. Typical stopping events are a specific time in the future or a condition that the simulation itself fulfills. When a specific event happens amid the recreation is called an event schedule. By and large, an event routine is characterized for every event composed. In writing the term handler is frequently utilized synonymously. 1.3.3 ESTA Algorithm An ESTA algorithm is an event-scheduling/time-advance algorithm [19]. According to their occurrence time, the event notifications are listed inside the future event list, i.e., f el = [t1 , t2 , ..., tk ] where t1 ≤ t2 ≤ ... ≤ tk . (1.1) Here t1 in this case is where an event occurs in time. The diagram in Figure 1.5 below depicts the flow of the ESTA algorithm, which is subdivided into three main sections. 10 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS Figure 1.5 Flow chart explaining a discrete-event test system. They are: 1. Section 1. Initialization 2. Section 2. Event Processing 3. Section 3. Output Initialization employs three main processes: the first one is the clock, secondly, entities and finally, state variables. After that the simulator enters the second part and the events are processed in a loop. Here a type of specific event has been created, which is termed handler, in which current event is retrieved or recovered from the next events. The state variables, entities and update statistics might be changed by the event routine and new event notices are created. The simulation enters the final part of the process after receiving the valid loop of termination condition. Finally, the statistics are calculated in the output part of the process and will be written into files if necessary. SIMULATION SOFTWARE SELECTION FOR MATLAB 1.3.4 11 ANALYSIS: Determination of Time to Attain Steady State Condition for MATLAB By the end of fixed steady time final state will be achieved. You will achieve half of consistent state after one half a life, in the result we will achieve 75 percentage as unfaltering state after two half lives, and in the result we will attain 87.5 percentage enduring state after three half-lives. The enduring state will be attained after five half-lives, which is characterized in the thumb control (97% of consistent state accomplished). By utilizing a stacking dosage, without much effort you can attain the objective of an enduring state in the event that you have a medication with a long half life. For instance, it requires a 30 mg dosage once in multiple days on the off chance that you need to accomplish an unfaltering condition of fixation (Css) of 10 ng/mL. By-and-by, to accomplish an unfaltering state it will take 10 days. Accept that the dosage proportionality, a 60 mg measurement, will accomplish a Css of 20 ng/mL in 10 days, you will attain half an enduring state after a solitary dosage of 60 mg (i.e., 20 ng/mL × half = 10 ng/mL). Subsequently, you can accomplish the relentless state level inside two days and, as previously stated, it could accomplish the objective Css quickly. The stacking measurement is 60 mg and the upkeep dosage is 30 mg. A critical term in pharmacokinetics is “consistent state,” which can appear somewhat theoretical and confounding as well. Another way to think of it is to envision a carton of eggs in your kitchen and you take two eggs out to make an omelet for breakfast and somebody sees that there is a vacant spot in the egg carton and purchases two more eggs to put in the carton. Hence, when you wake up the following morning, there is no empty spot in the carton of eggs and if this procedure repeats and again there is an adjustment made to the number of eggs in the carton, despite the fact that you utilize them for a few days, it will dependably be the same. For this situation you could without much of a stretch comprehend that the rate of end is equivalent to the rate of info and here the eggs are at relentless state. 1.4 Simulation Software Selection for MATLAB It should be noted that the goal regarding various undertakings in mechanized manufacturing systems is to upgrade productivity and lower cost. To energize plans and review working techniques, the champion among the most typical methodologies is simulation because of the resultant variability and dynamic advantages of such model. Some of the various examinations to be conducted follow. There are certain suggestions made by Banks and Gibson when purchasing the diversion programming such as exactness and detail, incredible capacities, fastest speed, demo game plan of issue and comparing associations with practically identical applications by looking at accumulated social events of customers. Together with their levels of essentialness for the specific reason, a purpose behind the development of propagation packages in the amassing region was presented by 12 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS Hlupic and Paul. While evaluating discrete-event diversion programming, a criteria for the structure should be considered, which was created by Nikoukaran et al [3]. A two-phase evaluation and selection methodology for simulation programming decisions was proposed by Tewoldeberhan et al. [4], in which the feature of propagation packages discussed above was empowered by the connection of two-phase evaluation in organized manner. For apparent improvement of each propagation package different methodologies are used in two-phase propagation evaluation. For discrete-event multiplication, Seila et al. [5] showed a framework to pick the reenactment programming. The proposed framework attempts to recognize the endeavored target first by assessing around 20 programming instruments, since a run-of-the-mill understanding of the objective will help plot charts with internal association resources and also dealer and expert associations. A criterion which can help pros veritably assure business process organization tools was made by Popovi et al. [6]. By including the decision of propagation programming, these examinations are prepared with a more theoretical approach to the issues. This section discusses the programming model, followed by how to use it in the most efficient way, as it gives a couple of optimizing methods like representation of database model and the way the database has to handle the queries. Lastly, essential broadcasting of the analysis right from the inside of Smart Sim Selector can be derived and represented for future enhancement. 1.5 Simulation Tools Based on High Performance A mobile ad hoc network (MANET) consists of several specific types of networks. One type is a wireless sensor network (WSN), shaped by several sensing devices which employ wireless transmission as the communication medium. It shares the same technical problems which have been noted in the research done on WSNs and MANETs. Two particular factors arise in WSN: usually one of the purposes of sensors is to measure the physical variables which are driven by the protocol layer operations and applications. Hence, the network which governs various types of topologies and traffic load are sensed by the dynamics of physical parameters. In WSN, the primary concern is energy, and frequently the nodes will run on non-rechargeable batteries. Hence, as expected, the lifetime of a node is a fundamental element and must be taken into account. In actuality, in MANETs, vitality is an essential issue that ought to be enhanced, despite the fact that it is for the most part accepted that a hub can energize or supplant its battery. In the interim, sending and working a testbed to examine the real conduct of conventions and system execution is an awesome undertaking [7, 8]. Therefore, recreation is fundamental to contemplate wireless sensor network, since it is the preliminary process in testing newer applications as well as conventions in this field. For this reason, in reality this field has brought about an ongoing surge in reproduction apparatuses accessible to WSNs. SIMULATION TOOLS BASED ON HIGH PERFORMANCE 13 This scenario contains two key angles which ought to be assessed earlier than directed analysis: Firstly, its accuracy and, secondly, the reasonableness of executing a specific device. On the other hand, an expanding worry regarding strategy as well as presumptions regarding simulations have been presented by Aktar et al. [9] as follows: Admired equipment and conventions can prompt outcomes with mixed results. A “decent” model in view of strong presumptions is compulsory to infer trusted outcomes. In any case, including the required level of detail includes solid computational prerequisites. The essential trade-off is: Exactness and need for detail versus execution and adaptability. A device that constructs a model is required, and the client faces the task of choosing the fitting one. Reproduction programming normally gives a structure to demonstrate and recreate the conduct of genuine frameworks. 1.5.1 Network Model Figure 1.6 shows a model of a wireless sensor network that depicts the general structure of the network which occurs on a wide scale [18]. Figure 1.6 Wireless sensor network model. The component descriptions are given below: 1. Nodes: Defined as a set of physical variables monitored by a physical device; each node refers to a physical device. Nodes can communicate with each other through a common radio channel. To control communications internally, a protocol stack is used. A sensor model is not similar to classical network models and it includes secondary components which involve the concept of physical node tier. In additional to it, a “topology” component may control node coordinates, which is not shown in Figure 1.6. 2. Environment: Additionally, an “environment” component is the major dissimilarity from the classical and wireless sensor network models. The nodes which are sensed by this component model trigger sensor actions along with the creation and growth of events, i.e., in the network, communication occurs between nodes. 14 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS 3. Radio channel model: In the network, nodes signal propagation and can be characterized by the radio channel model. In ratio model, terrain components are used to calculate the growth of the radio channel. 4. Sink nodes of wireless sensor network model: Sink nodes are known as the special nodes in the network which receive the data present and process it. A note of interest is that they might be integrated in sensors to interrogate the sensors. Testing is performed by the simulator and the sink node used depends on the application. 5. Agents: Agents act as an event generator among the nodes which are present in the network. In the propagation through the environment and the sensor stimulation, the agent is also used to modify the physical magnitude. Because of cross-layer interdependencies, node conduct relies upon collaborating factors. As shown in Figure 1.7, nodes are advantageous for partitioning a hub into theoretical levels. Figure 1.7 Tier-based node model. All the correspondence conventions are included in the protocol level. There are three layers which coincide with this level; for example, a directing layer, a MAC layer, and a particular application layer. In this way, in order to trade level data, a productive strategy must be created. The physical-hub level speaks to the equipment stage and its impacts on the execution of the instrument. An arrangement of physical sensors – the vitality module and the portability module – are known as normal components of this level. Physical sensors take the lead in checking equipment. An urgent issue of WSNs takes place at the equipment stage, where the vitality module mimics utilization management. Sensor position is controlled by the versatility module. A hub is associated through two conditions: SIMULATION TOOLS BASED ON HIGH PERFORMANCE 15 – Condition 1 - Associated through a radio channel – Condition 2 - Associated through at least a physical channel. 1.5.2 Network Simulators Some of tools of wireless sensor network are network simulators, while others are emulators. A network simulator is a tool used to evaluate network protocol performance in a wireless sensor network, it simulates the network. Some simulators that are discussed here are NS-2, Sensor Sim, SENS, and Em Star [12, 14, 20-22]. Table 1.1 Summary of the most important network simulators. 16 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS A network emulator is a tool used to evaluate real hardware performance on the nodes of a wireless sensor network. Some emulators that are discussed here are TOSSIM, ATEMU and AVRORA. Each of these classes and tools has its specific advantages and disadvantages and often the selection of the tool is mainly based on the experience of the researcher rather than on rational arguments. An overview of the different tools and simulation environments with their particular pros and cons has been established by the CRUISE project.The most relevant simulation environments used to study WSN are introduced and their main features and implementation issues are also described. 1.5.2.1 Network Simulator-2 Network Simulator-2 (NS-2)1 is a discrete event simulator that was designed especially to simulate transmission control protocol (TCP) on wireless and wired networks and it was developed in C++. NS-2 is one of the most popular non-specific network simulators, and supports a wide range of protocols in all layers. It uses OTCL as configuration and script interface. NS-2 is the paradigm of reusability. It provides the most complete support of communication protocol models, among noncommercial packages. Regarding WSN, NS-2 includes Ad-Hoc and WSN specific protocols such as directed diffusion or SMAC. NS-2 can comfortably model wired network topologies up to 1,000 nodes or above with some optimizations. The drawbacks of NS-2 is that the learning curve to operate the simulator is considerable, and knowledge of a scripting language, queuing theory, and modeling techniques is required; also, because the protocols are written in the object-oriented language C++, the simulator does not scale well for simulations of large wireless sensor node networks, as each node is represented as an object and performance is significantly affected. Another disadvantage of NS-2 is that it provides poor graphical support, via Nam. This application just reproduces a NS-2 trace. NS-2 has been an essential testing tool for network research and, so, one could expect that the new conventional protocols will be added to future releases. 1.5.2.2 AVRORA AVRORA2 is another WSN simulator that simulates a sensor system at a very finely granular level; it was developed by Ben Titzer et al. [12] at UCLA. AVRORA attempts to achieve the advantages of TOSSIM and ATEMU, and mitigate these two emulator’s disadvantages. While TOSSIM and ATEMU are written in the programming language C, AVRORA is written in Java. AVRORA emulates the node operation by running code instruction-by-instruction. The unique feature of AVRORA is how it handles the synchronization of nodes. There are two modes of synchronization: one uses a regular interval that can be set by the emulation operator to synchronize nodes; the other mode allows nodes to proceed along in simulation, until it reaches a state where it has to synchronize with its neighbors. Both of these synchronization modes reduce the overhead introduced by the synchronization function, as compared to TOSSIM and ATEMU. 1 https://www.isi.edu/nsnam/ns/ 2 compilers.cs.ucla.edu/avrora/ SIMULATION TOOLS BASED ON HIGH PERFORMANCE 1.5.2.3 17 OMNET++ OMNET++ (Object-oriented modular discrete event simulator)3 is a modular discrete event simulator implemented in C++. Getting started with it is quite simple, due to its clean design. OMNET++ also provides a powerful GUI library for animation and tracing and debugging support. Its major drawback is the lack of available protocols in its library, compared to other simulators. However, OMNET++ is becoming a popular tool and its lack of models is being cut down by recent contributions. For instance, a mobility framework has recently been released for OMNET++, and it can be used as a starting point for WSN modeling. Additionally, several new proposals for localization and MAC protocols for WSN have been developed with OMNET++ under the Consensus project, and the software is publicly available. Nevertheless, most of the available models have been developed by independent research groups and don’t share a common interface, which makes it difficult to combine them. 1.5.2.4 J-Sim J-Sim (JavaSim)4 is a component-based simulation environment developed entirely in Java. It provides real-time process-based simulation. The main benefit of J-Sim is its considerable list of supported protocols, including a WSN simulation framework with a very detailed model of WSNs, and an implementation of localization, routing and data diffusion WSN algorithms. J-Sim models are easily reusable and interchangeable, offering the maximum flexibility. Additionally, it provides a GUI (Graphical user interface) library for animation, tracing and debugging support and a script interface named Jacl. 1.5.2.5 NCTUns2.0 NCTUns2.05 is a discrete event simulator whose engine is embedded in the kernel of a UNIX machine. The actual network layer packets are tunneled through virtual interfaces that simulate lower layers and physical devices. This notable feature allows simulations to be fed with real program data sources. A useful GUI is available in addition to a high number of protocols and network devices, including wireless LAN. Unfortunately, no specific designs for WSN are included. On one hand, the close relationship between the simulation engine of NCTUns2.0 and the Linux kernel machine seems a difficulty (adding WSN simulation modules to this architecture is not a straightforward task). But, on the other hand, real sensor data can be easily plugged into simulated devices, protocols and actual applications, just by installing these sensors in the machine. NCTUns2.0 also has worthy graphical edition capabilities. 1.5.2.6 JiST/SWANS JiST (Java in Simulation Time)/SWANS (Scalable Wireless Ad hoc Network Simulator)6 is a discrete event simulation framework that embeds the simulation engine 3 www.omnetpp.org/ 4 https://www.physiome.org/jsim/ 5 http://nsl.csie.nctu.edu.tw/nctuns.html 6 http://jist.ece.cornell.edu/ 18 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS in the Java byte code. Models are implemented in Java and compiled. Then, byte codes are rewritten to introduce simulation semantics. Afterwards, they are executed on a standard Java virtual machine (JVM). This implementation allows the use of unmodified existing Java software in the simulation, as occurs with NCTUns2.0 and UNIX programs. The main drawback of JiST tool is the lack of enough protocol models. At the moment it only provides an Ad-hoc network simulator called SWANS, built atop JiST engine, and with a reduced protocol support. The only graphical aid is an event logger. JiST claims to scale to networks of 106 wireless nodes with two and one order of magnitude better performance (execution time) than NS-2 and GloMoSim7 respectively. It also has been shown that it outperforms GloMoSim and NS-2 in event throughput and memory consumption, despite being built with Java. Parsec is a simulation language derived from C that adds semantics for creating simulation entities and message communication on a variety of parallel architectures. Taking advantage of parallelization, it has been shown to scale to 10,000 nodes. 1.5.2.7 TOSSIM TOSSIM (Tiny operating system sensor network)8 is a bit-level discrete event simulator and emulator of TinyOS, i.e., for each transmitted or received bit an event is generated instead of one per packet. This is possible because of the reduced data rate (around 40 kbps) of the wireless interface. TOSSIM simulates the execution of nesC code on a TinyOS/MICA, allowing emulation of actual hardware by mapping hardware interruptions to discrete events. A simulated radio model is also provided. Emulated hardware components are compiled together with real TinyOS components using the nesC compiler. Thus, an executable with real TinyOS applications over a simulated physical layer is obtained. Additionally, there are also several communication services that provide a way to feed data from external sources. The result is a high fidelity simulator and emulator of a network of TinyOS/MICA nodes. The goal of TOSSIM is to study the behavior of TinyOS and its applications rather than performance metrics of some new protocol. Hence, it has some limitations; for instance, it does not capture energy consumption. Another drawback of this framework is that every node must run the same code. Therefore, TOSSIM cannot be used to evaluate some types of heterogeneous applications. TOSSIM can handle simulations around a thousand of motes. It is limited by its bit-level granularity: Performance degrades as traffic increases. Channel sampling is also simulated at bit level and consequently the use of a carrier sense multiple access (CSMA) protocol causes more overhead than a time division multiple access (TDMA) one. 1.5.2.8 EmStar/EmSim/EmTOS EmStar9 is a software framework to develop WSN applications on special platforms called microservers: Ad hoc systems with better hardware than a conventional 7 networksimulationtools.com/glomosim-simulator-projects/ 8 networksimulationtools.com/tossim/ 9 https://www.usenix.org/legacy/publications/library/proceedings/usenix04/tech/general/full /girod/girod html/eu.html papers SIMULATION TOOLS BASED ON HIGH PERFORMANCE 19 sensor. The EmStar environment contains a Linux microkernel extension, libraries, services and tools. The most important tools are: EmSim: A simulator of the microserver’s environment. In EmSim, every simulated node runs an Em-Star stack, and is connected through a simulated radio channel model. It is not a discrete event but a time-driven simulator; that is, there is no virtual clock. EmCee: An interface to real low-power radios, instead of a simulated radio model, obtaining radio emulation. EmStar source code (this code can be in any language) is used in the simulations. EmTOS: An extension of EmStar that enables nesC/TinyOS applications to run in an EmStar framework. Thus, it opens the way to heterogeneous systems of sensor and microservers. Simulation of microserver and sensor networks is also supported. In addition, EmTOS provides three modes of emulation: “Pure Emulation,” where all the motes are emulated by software, “Real Mode,” where all the motes are real, and “Hybrid Mode,” where some motes are real and others are emulated. EmTOS reaches up to 200 motes and it is claimed that for over 500 nodes it would be necessary to distribute the simulation on several processors. 1.5.2.9 ATEMU ATEMU10 , which stands for “Atmel Emulator,” is a fine-grained sensor network simulator by Polley et al. ATEMU is described as a bridge between an actual deployment of a Wireless Sensor Network system, and a Wireless Sensor Network simulator, a hybrid simulator, where the operation of individual sensor nodes is emulated in an instruction by instruction manner, and their interactions with each other via wireless transmissions are simulated in a realistic manner [12]. Although it was not specifically designed for MICA2 motes and TinyOS, much of the research and testing of ATEMU was performed with this platform. It is an emulator of the AVR processor (this processor is used in the MICA platform). Although the operation of the mote is emulated instruction by instruction, the radio model is simulated. ATEMU also provides a library of other hardware devices, e.g., timers or transceivers. Therefore, a complete hardware platform is emulated, obtaining two advantages: 1. The capability of testing OS and applications other than TinyOS. 2. The capability of simulating heterogeneous networks with different sensors. They are achieved at the cost of high processing requirements and poor scalability. A key weakness to ATEMU is that it is significantly, approximately 30 times, slower that TOSSIM. 10 http://www.hynet.umd.edu/research/atemu/ 20 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS 1.5.2.10 SENS SENS is a Wireless Sensor Network simulator that was developed by the Open Systems Laboratory at the University of Illinois at Urbana-Champaign (UIUC) in 2004. SENS was developed as a customizable sensor network simulator for WSN applications. It has four main components that function to simulate the sensor node and network, and the environments in which the network might operate. There is an application component that simulates the software of the sensor node; and a network component that simulates the transmission of packets among the nodes. It operates in one of three modes: successful packet transmission, a probability of packet loss, and packet collision. The third component is the physical component that simulates the power, sensor, and actuator parts of the sensor node and interface with the fourth component, the environment. The environment component is simulated by considering how different surfaces affect radio wave propagation. The environment simulation component is the key benefit of SENS; it is otherwise less customizable than other network simulators. This discrete event simulator is implemented in C++. SENS utilizes a simplified sensor model with three layers (application, network and physical) plus an additional combined environment and radio layer. NesC code can be used directly on it. 1.5.2.11 PROWLER/JPROWLER PROWLER/JPROWLER is a discrete event simulator running under MATLAB intended to optimize network parameters. JPROWLER11 is a version of PROWLER (Probabilistic wireless network simulator) developed in Java. 1.5.2.12 SNAP SNAP (Simulation analysis platform)12 is a totally different approach. SNAP is defined as an integrated hardware simulation and deployment platform. It is a microprocessor that can be used in two ways: 1. As the core of a deployed sensor. 2. As part of an array of processors that performs parallel simulation. Again, “real” code for sensors can be simulated. By combining arrays of SNAPs (called network on a chip), it is claimed to be able to simulate networks on the order of 100,000 nodes. 1.5.2.13 SensorSim SensorSim13 is another network simulator, which is based on NS-2. This simulator was developed in the network and embedded systems laboratory at UCLA. Similar to the model power that is used in the minimize usage extend life (MUEL) simulator, SensorSim enhanced NS-2 by having an advanced power model, taking 11 https://w3.isis.vanderbilt.edu/projects/nest/jprowler/ 12 snap.stanford.edu/ 13 https://www.swmath.org/software/15014 SIMULATION TOOLS BASED ON HIGH PERFORMANCE 21 into account all of the components on a sensor node that would use energy. Further, a significant advancement of SensorSim was to include, first a sensor channel, and later, a mechanism that allowed the simulation of external events that would trigger a reaction in the simulation. Another significant contribution of SensorSim was the development of a middleware software tool called sensor ware. This middleware functioned between the simulator and the simulated sensor nodes, and allowed dynamic management of nodes during simulation, such as the loading of scripts or other applications to the nodes. SensorSim, having evolved from NS-2, had similar problems of scalability, and is not publicly available today. 1.5.2.14 SSFNET SSFNET (Scalable simulation framework network) 14 is a collection of Java SSFbased components for modeling and simulation of Internet protocols and networks at and above the IP packet level of detail. Link layer and physical layer modeling can be provided in separate components. SSFNet models are self-configuring; that is, each SSFNet class instance can autonomously configure itself by querying a configuration database, which may be locally resident or available over the Web. The network configuration files are in the DML format. They are used to configure a complete model, and instantiate a simulation with the help of the scalable DML configuration database package that is distributed with the SSF simulators. The principal classes used to construct virtually any Internet model are organized into two derivative frameworks, SSF.OS (for modeling of the host and operating system components, esp. protocols) and SSF.Net (for modeling network connectivity, creating node and link configurations). The frameworks SSF.OS and SSF.Net hide all details of the discrete event simulator SSF API, allowing the same implementation of protocols as in a real operating system. 1.5.2.15 Ptolemy The Ptolemy15 project studies modeling, simulation, and design of concurrent, real-time, embedded systems. The focus is on assembly of concurrent components. The key underlying principle in the project is the use of well-defined models of computation that govern the interaction between components. A major problem area being addressed is the use of heterogeneous mixtures of models of computation. A software system called Ptolemy II is being constructed in Java. The work is conducted in the industrial cyber-physical systems center (iCyPhy) in the department of electrical engineering and computer sciences of the University of California at Berkeley. The project is directed by Prof. Edward Lee. The project is named after Claudius Ptolemaeus, the second century Greek astronomer, mathematician, and geographer. 14 www.ssfnet.org 15 https://ptolemy.berkeley.edu/ 22 1.6 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS Conclusion Propagation is a principal tool to consider remote sensor systems in context of authentic analysis. This particular analysis suggests methods to detect recurrences in wireless sensor network and is also used for model representation every time the tool has been used. According to the concept of the models, OMNET++16 (Object-oriented modular discrete event simulator) and SSFNET17 (Scalable simulation framework network) limitations of open tradition models diverge from various test frameworks (uncommonly, NS-2), which constructs progression time. Mechanical assemblies like NCTU NS2.0 (Network Simulation 2.0), Linux operating system or Java platform are independently used in a propagation. At this stage, potential results immensely increase. In practice, mechanical assemblies, for instance, TOSSIM18 (Tiny operating system sensor network), EmTOS or ATEMU, can reproduce certifiable sensor code. In any case, late test framework shows that suitable software (JiST/SWAN) results in a performance that is higher than network simulation and GloMoSim19 (in its back-to-back shape). Unmistakably, parallel simulations should perform and scale better than back-to-back ones. Parallel test frameworks, such as GloMoSim (whose goal is execution instead of flexibility), can reenact up to the limit of ten thousand remote center points. The standard aim of DASSF (Digital access signaling system Fi) parallel mechanical assembly is flexibility, with supportive topology arrangements as sweeping as hundred hundreds of wired parts. Graphical support is given by all the groups. OMNET++, NCTU NS2.0, J-SIM (Simulation) and Ptolemy software provide momentous GUI (Graphical user interface) libraries for development as well as investigation. This chapter gave a clear explanation on the importance of simulation and how the process of simulation goes from scratch to the next level by implementing basic programming. We focused on explaining the whole concept with basic programming like Java and in some places we utilized Python code for making the models’ design and implementing simple theories of the networking. We started with a discussion on MATLAB modeling and simulations and continued with a discussion on the types of simulations needed. Next, discrete event simulation using MATLAB was explained in brief. Then, the simulation software used for the modeling and simulation was explained and finally the tools used for high performance computing using network simulation methodology were explained. 16 www.omnetpp.org/ 17 www.ssfnet.org 18 networksimulationtools.com/tossim/ 19 networksimulationtools.com/glomosim-simulator-projects/ CONCLUSION 23 REFERENCES 1. Banks, J., & Gibson, R. (1997). Simulation modeling: some programming required. IIE Solutions, 29, 26-31. 2. Hlupic, V., & Paul, R. J. (1999). Guidelines for selection of manufacturing simulation software. IIE transactions, 31(1), 21-29. 3. Nikoukaran, J., Hlupic, V., & Paul, R. J. (1999). A hierarchical framework for evaluating simulation software. Simulation Practice and Theory, 7(3), 219-231. 4. Tewoldeberhan, T. W., Verbraeck, A., Valentin, E., & Bardonnet, G. (2002, December). An evaluation and selection methodology for discrete-event simulation software. In Simulation Conference, 2002. Proceedings of the Winter (Vol. 1, pp. 67-75). IEEE. 5. Seila, A. F., Ceric, V., & Tadikamalla, P. R. (2003). Applied simulation modeling. Brooks/Cole. 6. Popovi, A., Hackney, R., Coelho, P. S., & Jakli, J. (2012). Towards business intelligence systems success: Effects of maturity and culture on analytical decision making. Decision Support Systems, 54(1), 729-739. 7. Ahloowalia, B. S., Maluszynski, M., & Nichterlein, K. (2004). Global impact of mutation-derived varieties. Euphytica, 135(2), 187-204. 8. Ahn, S.; Mukelar, A. Rice Blast Management Under Upland Conditions. Progress in Upland Rice Research; Int. Rice Res. Inst.: Manila, 1986; pp 363-374. 9. Aktar, M. W.; Sengupta, D.; Chowdhury, A. Impact of Pesticides Use in Agriculture: Their Benefits and Hazards. Interdiscip. Toxicol. 2009, 2, 1-12. 10. Paluszek, M., & Thomas, S. (2019). MATLAB Graphics. In MATLAB Machine Learning Recipes (pp. 45-71). Apress, Berkeley, CA. 11. Henriksson, D., Cervin, A., & Arzn, K. E. (2003, October). TrueTime: Real-time control system simulation with MATLAB/Simulink. In Proceedings of the Nordic MATLAB Conference. Copenhagen, Denmark. 12. Pathan, A. S. K., Monowar, M. M., & Khan, S. (2014). Simulation technologies in networking and communications: selecting the best tool for the test. CRC Press. 13. Law, A. M., Kelton, W. D., & Kelton, W. D. (1991). Simulation modeling and analysis (Vol. 2). New York: McGraw-Hill. 14. Chang, X. (1999). Network simulations with OPNET. In WSC’99. 1999 Winter Simulation Conference Proceedings. Simulation-A Bridge to the Future (Cat. No. 99CH37038) (Vol. 1, pp. 307-314). IEEE. 15. Jain, R. (1990). The art of computer systems performance analysis: techniques for experimental design, measurement, simulation, and modeling. John Wiley & Sons. 16. Law, A. M., Kelton, W. D., & Kelton, W. D. (2000). Simulation modeling and analysis (Vol. 3). New York: McGraw-Hill. 17. Jain, R. (1990). The art of computer systems performance analysis: techniques for experimental design, measurement, simulation, and modeling. John Wiley & Sons. 18. Shah, R. C., Roy, S., Jain, S., & Brunette, W. (2003). Data mules: Modeling and analysis of a three-tier architecture for sparse sensor networks. Ad Hoc Networks, 1(2-3), 215233. 24 INTRODUCTION TO MODELING, SIMULATIONS AND ANALYSIS 19. Fortier, P. J. (2018). Modeling and Analysis of Local Area Networks, CRC Press. 20. Sommer, C., Eckhoff, D., Brummer, A., Buse, D. S., Hagenauer, F., Joerer, S., & Segata, M. (2019). Veins: The open source vehicular network simulation framework. In Recent Advances in Network Simulation (pp. 215-252). Springer, Cham. 21. Aktas, I., King, T., & Mengi, C. (2010). Modeling application traffic. In Modeling and Tools for Network Simulation (pp. 397-426). Springer, Berlin, Heidelberg. 22. Frasconi, P., & Smyth, P. (2003). Modeling the Internet and the Web: probabilistic methods and algorithms. Wiley. 23. Burbank, J. L., Kasch, W., & Ward, J. (2011). An introduction to network modeling and simulation for the practicing engineer (Vol. 5). John Wiley & Sons. 24. Surez, F. J., Nuo, P., Granda, J. C., & Garca, D. F. (2015). Computer networks performance modeling and simulation. In Modeling and Simulation of Computer Networks and Systems (pp. 187-223). Morgan Kaufmann. 25. Guizani, M., Rayes, A., Khan, B., & Al-Fuqaha, A. (2010). Network modeling and simulation: a practical perspective. John Wiley & Sons. CHAPTER 2 INTRODUCTION TO MATLAB PROGRAMMING Abstract In this chapter, we have tried to show the power of MATLAB for computational mathematics, followed by a detailed description of the features. Also discussed in detail are the various areas in which MATLAB is used. We discuss the various notations, operators and syntax along with hands-on practical examples and various loop structures and decision controls, import and export operations, use and creation of M-files, different types of plotting and graphs, etc. We also explain the various clones of MATLAB. This chapter will effectively help readers understand the workings and uses as well as applications of MATLAB more clearly. Keywords: MATLAB features, toolbox in MATLAB, functionalities in MATLAB, scilab Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 25 26 2.1 INTRODUCTION TO MATLAB PROGRAMMING Introduction MATLAB (Matrix Laboratory) is a fourth-generation, high-level programming language for numerical computation, visualization and programming, which can interact with the environment [1-4]. MATLAB was developed by MathWorks.1 Figure 2.1 MathWorks MATLAB R2018b MATLAB’s power lies in the fact that it is used for every facet of computational mathematics. Some of the mathematical calculations that are commonly used are: Matrices Calculations Array Processing Two-Dimensional Plotting Three-Dimensional Plotting Curve Fitting Linear Algebraic Calculations Numerical Calculations Usage of Nonlinear Functions Transformations Statistical and Data Analysis Calculus Equations Integration Process Differential Equations Curve Fitting 1 https://www.mathworks.com/ BASIC FEATURES 2.2 27 Basic Features 2.2.1 Features of MATLAB For numerical calculation, perception and application advancement, MATLAB is one of the nonstandard state languages. A collaborative environment for iterative investigation, the outlining of roles as well as critical thinking is provided by MATLAB. MATLAB optimizes a design to meet a custom objective and creates custom plots for devices. MATLAB’s modifying interface improves devices by enhancing code, model practicality, and by boosting execution. 2.2.2 Uses of MATLAB A range of the following applications are used in MATLAB:2 Signal Processing Communications System Image Processing Video Processing Control Systems Testing Measurement Computational Finance Computational Biology 2.3 Notation, Syntax, and Operations The MATLAB environment behaves like a super-complex calculator and commands can be given in the window named Command Prompt as >>. It is one of the interpreted environments which MATLAB also executes in the right way if you give the commands [5, 6]. 2.3.1 Practical Examples for MATLAB Give an expression for the concept of instance, 1 5+5 Then click ENTER in the menu. 2 https://www.tutorialspoint.com/matlab/matlab overview.htm 28 INTRODUCTION TO MATLAB PROGRAMMING MATLAB executes immediately once the Execute button is pressed or while given as (Ctrl+E) and the result is 1 ans = 10 Let us take some more examples 1 3ˆ2 % 3 raised to the power of 2 MATLAB executes immediately once the Execute button is pressed or while given as (Ctrl+E). OUTPUT 1 ans = 9 One more sample, 1 sin(pi / 2) % sine of angele 90 degree MATLAB executes immediately once the Execute button is pressed or while given as (Ctrl+E). OUTPUT 1 ans = 1 Another example, 1 7/0 % Divide by zero MATLAB executes immediately once the Execute button is pressed or while given as (Ctrl+E). OUTPUT 1 2 Ans = Inf Warning: division by zero Another example, 1 732 * 20.3 MATLAB executes immediately once the Execute button is pressed or while given as (Ctrl+E). OUTPUT 1 ans = 1.4860e+04 2.3.2 Use of Semicolon (;) in MATLAB For an articulation, include a semicolon after articulation in the event that you need to control and hide the MATLAB yield and a semicolon (;) to show the end of explanation. For example, 1 2 x = 3 y = x + 5 NOTATION, SYNTAX, AND OPERATIONS 29 MATLAB executes immediately once the Execute button is pressed or while given as (Ctrl+E). OUTPUT 1 y = 8 2.3.3 Adding Comments For indicating a comment line, the percent symbol (%) is used. For example, 1 x = 9 % assign the value 9 to x Using the block comment operators % {and %} and here block of comments are also possible to write. To assist you with adding, expel or change the configuration of remarks, the devices and the setting menu objects are incorporated into the MATLAB supervisor. 2.3.4 Commonly Utilized Operators and Special Characters MATLAB bolsters the accompanying commonly utilized administrators and unique characters. Table 2.1 Operators and special characters. 30 INTRODUCTION TO MATLAB PROGRAMMING 2.3.5 Unique Variables and Constants MATLAB underpins the accompanying unique factors and constants Table 2.2 2.3.6 Unique variables and constants. Sparing Process For sparing every one of the factors in the workspace, spare summons is utilized as a record with tangle expansion in the present index. For example: 1 save my life By using the load command the reload process will be activated. This process is possible at anytime. 1 load my life 2.3.7 MATLAB Decisions The developer ought to indicate at least one condition to be assessed or tried by the program which is required by the basic leadership structures, and if the condition is resolved to be valid, along with an announcement or articulations to be executed, and different proclamations are executed in case if the condition is false [7, 8]. Figure 2.2 MATLAB decision. NOTATION, SYNTAX, AND OPERATIONS 31 In vast maximum programming dialects, the general type of an average basic leadership structure is found. MATLAB gives the accompanying sorts of basic leadership articulations and to check their detail taps the accompanying connections. To explain the operations in MATLAB we can consider the following table for clarification. Table 2.3 2.3.8 Variables and constants. MATLAB Loops There may be a circumstance where a block of code is executed a specific number of times, and as a rule the announcements are executed continuously [9-12]. In this case the primary proclamation is executed first, trailed constantly, etc. The few control structures which are given by the programming dialects take into consideration more convoluted ways of execution. Executing an announcement or gathering of proclamations in numerous events is permitted by a circle articulation and the general structure of the circle is explained in the vast majority of the programming dialects as Figure 2.3 MATLAB loops. 32 INTRODUCTION TO MATLAB PROGRAMMING Table 2.4 Table 2.5 Articulations. Loop control statements. For example, 1 2 x = 3 y = x + 5 2.4 Import and Export Operations 2.4.1 Import Data in MATLAB In MATLAB the loading data from an external file is known as import data. By using the IMPORT DATA function different formats of several data files are loaded. Syntax: A = importdata(filename) A = importdata(’-pastespecial’) A = importdata(___,delimiterIn) A = importdata(___,delimiterIn,headerlinesIn) [A,delimiterOut,headerlinesOut] = importdata(___) Description A = importdata(filename) loads data into array A. A = importdata(’-pastespecial’) loads data from the system clipboard rather than from a file. A = importdata(___, delimiterIn) interprets delimiterIn as the column separator in ASCII file, filename, or the clipboard data. You can use delimiterIn with any of the input arguments in the above syntaxes. IMPORT AND EXPORT OPERATIONS 33 A = importdata(___, delimiterIn, headerlinesIn) loads data from ASCII file, filename, or the clipboard, reading numeric data starting from line headerlinesIn+1. [A, delimiterOut, headerlinesOut] = importdata(___) additionally returns the detected delimiter character for the input ASCII file in delimiterOut and the detected number of header lines in headerlinesOut, using any of the input arguments in the previous syntaxes. Example 2.4.1 Load and show a picture document. Make a content record and sort the accompanying code in it. 1 2 3 filename = ’smile.jpg’; A = importdata(filename); image(A); Execute the record, it shows picture document. Nonetheless, we should save in present index. Simulation result: Example 2.4.2 Import a content record as well as determine Delimiter and Header for all the columns. Weeklydata.txt file 1 2 3 4 5 6 SunDay MonDay TuesDay WednesDay ThursDay FriDay SaturDay 95.01 76.21 61.54 40.57 55.79 70.28 81.53 73.11 45.65 79.19 93.55 75.29 69.87 74.68 60.68 41.85 92.18 91.69 81.32 90.38 74.51 48.60 82.14 73.82 41.03 0.99 67.22 93.18 89.13 44.47 57.63 89.36 13.89 19.88 46.60 PROGRAM 1 2 3 4 5 filename =’weeklydata.txt’; delimiterIn = ’ ’; headerlinesIn =1; A = importdata(filename,delimiterIn,headerlinesIn); 34 6 7 8 9 10 11 INTRODUCTION TO MATLAB PROGRAMMING %View data for k =[1:7] disp(A.colheaders{1, k}) disp(A.data(:, k)) disp(’ ’) end OUTPUT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 SunDay 95.0100 73.1100 60.6800 48.6000 89.1300 Monday 76.2100 45.6500 41.8500 82.1400 44.4700 Tuesday 61.5400 79.1900 92.1800 73.8200 57.6300 Wednesday 40.5700 93.5500 91.6900 41.0300 89.3600 Thursday 55.7900 75.2900 81.3200 0.9900 13.8900 Friday 70.2800 69.8700 90.3800 67.2200 19.8800 Saturday 81.5300 74.6800 74.5100 93.1800 46.6000 IMPORT AND EXPORT OPERATIONS 35 Example 2.4.3 Import from clipboard. Arithmetic straightforward: Make content document then sort the accompanying program. 1 A = importdata(’-pastespecial’) The following result will be shown if you run the document 1 2 A = ’Mathematics is simple.’ Low-Level File I/O: Abnormal state work is the import information work. To control overly perusing or composing information to a record, MATLAB permits low-level document I/O capacities. To work proficiently, these capacities require more point-by-point data about your record. MATLAB gives the accompanying capacities to peruse and compose activities at the byte or character level. Table 2.6 Low-level file I/O functions. Function Description close Close one or all open files feof Test for end-of-file ferror Information about record I/O errors fgetl Read line from the data, removing newline characters fgets Read line from the file, keeping newline characters fopen Open the file, or obtain information about open files fprintf Write data to a text file fread Read data from binary file frewind Move file position indicator to the begin of the open file fscanf Read data from the text file fseek Move to the specified position in the file ftell Position in open file fwrite Write data to the binary file Import Text Data Files with Low-Level I/O: MATLAB provides the following functions for low-level import of text data files. The fscanf function reads formatted data in a text or ASCII file. The fgetl and fgets functions read one line of a file at a time, where a newline character separates each line. The fread function reads a stream of data at the byte or bit level. Example: We have a text data file ’myfile.txt’ saved in our working directory - the file stores rainfall data for three months; June, July, and August for the year 2012. 36 INTRODUCTION TO MATLAB PROGRAMMING The data in myfile.txt contains repeated sets of time, month and rainfall measurements at five places. The header data stores the number of months. M; so, we have M sets of measurements. The file looks like this 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Rainfall Data Months: June, July, August M = 3 12:00:00 June-2012 17.21 28.52 39.78 16.55 23.67 19.15 0.35 17.57 NaN 12.01 17.92 28.49 17.40 17.06 11.09 9.59 9.33 NaN 0.31 0.23 10.46 13.17 NaN 14.89 19.33 20.97 19.50 17.65 14.45 14.00 18.23 10.34 17.95 16.46 19.34 09:10:02 July-2012 12.76 16.94 14.38 11.86 16.89 20.46 23.17 NaN 24.89 19.33 30.97 49.50 47.65 24.45 34.00 18.23 30.34 27.95 16.46 19.34 30.46 33.17 NaN 34.89 29.33 30.97 49.50 47.65 24.45 34.00 28.67 30.34 27.95 36.46 29.34 15:03:40 August-2012 17.09 16.55 19.59 17.25 19.22 17.54 11.45 13.48 22.55 24.01 NaN 21.19 25.85 25.05 27.21 26.79 24.98 12.23 16.99 18.67 17.54 11.45 13.48 22.55 24.01 NaN 21.19 25.85 25.05 27.21 26.79 24.98 12.23 16.99 18.67 We will import data from this file and display this data. Take the following steps: Open the file with fopen function and get the file identifier. Describe the data in the file with format specifiers, such as ’%s’ for a string, ’%d’ for an integer, or ’%f’ for a floating-point number. To skip real characters in the file, include them in the format description. To skip a data field, use an asterisk (’*’) in the specifier. For example, to read the headers and return the single value for M, we write 1 M =fscanf(fid,’%*s %*s\n%*s %*s %*s %*s\nM=%d\n\n’,1); By default, fscanf reads data according to our format description until it does not find any match for the data, or it reaches the end of the file. Here we will use the loop for reading three sets of data, and each time; it will read seven rows and five columns. IMPORT AND EXPORT OPERATIONS 37 We will create a structure named mydata in the workspace to store data read from the file. This structure has three fields - time, month, and raindata array. Create a script file and type the following code in it. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 filename =’/data/myfile.txt’; rows =7; cols =5; fid = fopen(filename);% open the file % read the file headers, find M (number of months) M =fscanf(fid,’%*s %*s\n%*s %*s %*s %*s\nM=%d\n\n’,1); % read each set of measurements for n =1:M mydata(n).time= fscanf(fid, ’%s’,1); mydata(n).month= fscanf(fid, ’%s’,1); % fscanf fills the array in column order, %so transpose the results mydata(n).raindata=... fscanf(fid, ’%f’,[rows, cols]); end for n =1:M disp(mydata(n).time), disp(mydata(n).month) disp(mydata(n).raindata) end fclose(fid);% close the file When you run the file, it displays the following result 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 12:00:00 June-2012 17.2100 17.5700 11.0900 13.1700 14.4500 28.5200 NaN 9.5900 NaN 14.0000 39.7800 12.0100 9.3300 14.8900 18.2300 16.5500 17.9200 NaN 19.3300 10.3400 23.6700 28.4900 0.3100 20.9700 17.9500 19.1500 17.4000 0.2300 19.5000 16.4600 0.3500 17.0600 10.4600 17.6500 19.3400 09:10:02 July-2012 12.7600 16.9400 14.3800 11.8600 16.8900 20.4600 23.1700 NaN 34.0000 33.1700 24.4500 24.8900 18.2300 NaN 34.0000 19.3300 30.3400 34.8900 28.6700 30.9700 27.9500 29.3300 30.3400 49.5000 16.4600 30.9700 27.9500 47.6500 19.3400 49.5000 36.4600 24.4500 30.4600 47.6500 29.3400 15:03:40 August-2012 17.0900 13.4800 27.2100 11.4500 25.0500 16.5500 22.5500 26.7900 13.4800 27.2100 19.5900 24.0100 24.9800 22.5500 26.7900 38 INTRODUCTION TO MATLAB PROGRAMMING 26 27 28 29 17.2500 19.2200 17.5400 11.4500 2.4.2 NaN 12.2300 24.0100 24.9800 21.1900 16.9900 NaN 12.2300 25.8500 18.6700 21.1900 16.9900 25.0500 17.5400 25.8500 18.6700 Export Data in MATLAB Data export (or output) in MATLAB means to write into files. MATLAB allows you to use your data in another application that reads ASCII files. For this, MATLAB provides several data export options. You can create the following types of files: Rectangular, delimited ASCII data file from an array. Diary (or log) file of keystrokes and the resulting text output. Specialized ASCII file using low-level functions such as fprintf. MEX-file to access your C/C++ or Fortran routine that writes to a particular text file format. Apart from this, you can also export data to spreadsheets. There are two ways to export a numeric array as a delimited ASCII data file: Using the save function and specifying the -ASCII qualifier. Using the dlmwrite function. The syntax for using the save function is 1 Save my_data.out num_array -ascii where my_data.out is the delimited ASCII data file created, num_array is a numeric array and - ascii is the specifier. The syntax for using the dlmwrite function is 1 dlmwrite(’my_data.out’, num_array, ’dlm_char’) where my_data.out is the delimited ASCII data file created, num_array is a numeric array, and dlm_char is the delimiter character. Example: The following example demonstrates the concept. Create a script file and type the following code 1 2 3 4 5 num_array =[1234;4567;7890]; save array_data1.out num_array -ascii; type array_data1.out dlmwrite(’array_data2.out’, num_array,’ ’); type array_data2.out When you run the file, it displays the following result: IMPORT AND EXPORT OPERATIONS 1 2 3 4 5 6 7 39 1.0000000e+00 2.0000000e+00 3.0000000e+00 4.0000000e+00 4.0000000e+00 5.0000000e+00 6.0000000e+00 7.0000000e+00 7.0000000e+00 8.0000000e+00 9.0000000e+00 0.0000000e+00 1 2 3 4 4 5 6 7 7 8 9 0 Please note that the save -ascii command and the dlmwrite function does not work with cell arrays as input. To create a delimited ASCII file from the contents of a cell array, you can Either, convert the cell array to a matrix using the cell2mat function Alternatively, export the cell array using low-level file I/O functions. If you use the save function to write a character array to an ASCII file, it writes the ASCII equivalent of the characters to the file. For example, let us write the word ’hello’ to a file. 1 2 3 h =’hello’; Save textdata.out h -ascii type textdata.out MATLAB executes the above statements and displays the following result, which is the characters of the string ’hello’ in 8-digit ASCII format. 1 2 1.0400000e+02 1.0100000e+02 1.0800000e+02 1.0800000e+02 1.1100000e+02 Writing to Diary Files: Diary files are activity logs of your MATLAB session. The diary function creates an exact copy of your session in a disk file, excluding graphics. To turn on the diary function, type: 1 diary Optionally, you can give the name of the log file, say 1 Diary logdata.out To turn off the diary function 1 diary off You can open the diary file in a text editor. Exporting Data to Text Data Files with Low-Level I/O: So far, we have exported numeric arrays. However, you may need to create other text files, including combinations of numeric and character data, nonrectangular output files, or files with non-ASCII encoding schemes. For these purposes, MATLAB provides the low-level fprintf function. As in low-level I/O file activities, before exporting, you need to open or create a file with the fopen function and get the file identifier. By default, fopen opens a file for read-only access. You should specify the permission to write or append, such as ’w’ or ’a.’ 40 INTRODUCTION TO MATLAB PROGRAMMING After processing the file, you need to close it with fclose(fid) function. The following example demonstrates the concept. Example: Create a script file and type the following code in it. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 % create a matrix y, with two rows x = 0:10:100; y =[x; log(x)]; % open a file for writing fid =fopen(’logtable.txt’, ’w’); % Table Header fprintf(fid, ’Log Function\n\n’); %print values in column order % two values appear on each row of the file fprintf(fid,’%f %f\n’, y); fclose(fid); % display the file created Type logtable.txt When you run the file, it displays the following result. 1 2 3 4 5 6 7 8 9 10 11 12 13 Log Function 0.000000 -Inf 10.000000 2.302585 20.000000 2.995732 30.000000 3.401197 40.000000 3.688879 50.000000 3.912023 60.000000 4.094345 70.000000 4.248495 80.000000 4.382027 90.000000 4.499810 100.000000 4.605170 2.5 Elements After signing windowing domain by composing MATLAB at the UNIX incite you may start up MATLAB. 2.5.1 Commands Some essential UNIX charges can keep running in the MATLAB provoke, for example, disc and ls. You can see the UNIX Documentation Page for more insights about UNIX summons. In the event that you need assistance, as a rule MATLAB enables sort to help at inciting to get a rundown of assistance themes. Sort help at provoke to get help on a particular kind or capacity by supplanting with theme or otherwise capacity according to your wish regarding help. ELEMENTS 41 Sort exit at provokes to leave the MATLAB. Figure 2.4 2.5.2 MATLAB elements. MATLAB Basics To work with networks a MATLAB is planned, in which a lattice is characterized to be a rectangular exhibit of numbers. MATLAB does not require any compose presentations or measurement explanations dissimilar to programming dialects, for example, C or Java [10]. MATLAB consequently produces the variable and assigns the suitable measure of capacity when it meets another variable name. Sort the summon at provoke to verify the factors which exist as of now and furthermore to see the measurements. Enter the option clear to free the memory. Just compose variable name at incite, which makes variables is trailed by the equivalents sign (=), and taken after by the instatement, as exhibited below: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 PROGRAM To initialize a scalar a: >>a=[2] To initialize a row vector b: >>b=[1 2 3 4 5] Note that spaces between numbers signify a new column. To initialize a column vector c: >>c=[6; 7; 8; 9] Note that semicolons between numbers signify a new row. To initialize a three by three matrix M: >>M=[1 2 3; 4 5 6; 7 8 9] Again, spaces between numbers signify a new column, whereas semicolons signify a new row. 42 INTRODUCTION TO MATLAB PROGRAMMING 2.5.3 Creating Matrices MATLAB provides four capacities that enable you to effortlessly produce essential networks. The zeros capacity makes a network with all components equivalent to the value 0. Example 2.5.1 Make a (3 by 4) zeros network which is represented as Z: 1 >> Z = zeros (3, 4) Capacity makes network with all components equivalent to the value 1. Example 2.5.2 Make a (2 by 3) ones network is represented as O: 1 >> O = ones (2, 3) The rand work makes the framework consistently disseminate irregular components. Example 2.5.3 Make a (4 by 1) irregular lattice is represented as R: 1 >>R= rand(4, 1) The randn work makes a framework of regularly disseminated irregular components. For instance, making a (2 by 5) irregular network is represented as R: 1 >>R= randn(2, 5) 2.5.4 Framework Operations Some framework operations provided by MATLAB are shown in Table 2.7. Table 2.7 Framework operations. Operations Description + Matrix addition - Matrix subtraction . Takes the transpose of the matrix Dot product inv Take the inverse of a matrix eig Computes the eigenvalues of the square matrix det Computes the determinant of a matrix reff Calculates the reduced row echelon form of a matrix Example 2.5.4 Create an array, A, and add a scalar value to it. ELEMENTS 1 2 3 4 5 6 7 43 A = [0 1; 1 0]; C = A + 2 %Result C = 22 2 3 3 2 Example 2.5.5 Create two arrays, A and B, and add them together. 1 2 3 4 5 6 7 8 A = [1 0; 2 4]; B = [5 9; 2 1]; C = A + B %Result C = 22 6 9 4 5 Example 2.5.6 Create an array, A, and subtract a scalar value from it. 1 2 3 4 5 6 7 A = [2 1; 3 5]; C = A - 2 %Result C = 22 0 -1 1 3 Example 2.5.7 Create two arrays, A and B, and subtract the second, B, from the first, A. 1 2 3 4 5 6 7 8 A = [1 0; 2 4]; B = [5 9; 2 1]; C = A - B %Result C = 22 -4 -9 0 3 Example 2.5.8 Create two simple, three-element vectors. 1 2 A = [4 -1 2]; B = [2 -2 -1]; Calculate the dot product of A and B. 1 2 C = dot(A,B) C = 8 44 INTRODUCTION TO MATLAB PROGRAMMING The result is eight since C = A(1)*B(1) + A(2)*B(2) + A(3)*B(3) Create a matrix of real numbers and compute its transpose. B has the same elements as A, but the rows of B are the columns of A, and the columns of B are the rows of A. 1 2 3 4 5 6 7 A = magic(4) 1 2 3 4 5 6 7 B = A.’ A = 44 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 B = 44 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1 Example 2.5.9 Compute the inverse of a 3-by-3 matrix. 1 2 3 4 5 6 X = [1 0 2; -1 5 0; 0 3 -9] X = 33 1 2 3 4 5 6 Y = inv(X) Y = 33 1 0 2 -1 5 0 0 3 -9 2.5.5 0.8824 -0.1176 0.1961 0.1765 0.1765 0.0392 0.0588 0.0588 -0.0980 Using M-Files M-Files develop the script as well as define the functions in external files which can be allowed by MATLAB. To execute the file at the MATLAB prompt, type the filename without the .m extension and M-Files have the file extension .m. You can use the MATLAB editor or any other text editor to create your .m files. In this section, we will discuss the script files. A script file contains multiple sequential lines of MATLAB commands and function calls. You can run a script by typing its name at the command line. ELEMENTS 2.5.5.1 45 Creating and Running Script Files To create scripts files, you need to use a text editor. You can open the MATLAB editor in two ways: Using the command prompt Using the IDE If you are using the command prompt, type edit in the command prompt. This will open the editor. You can directly type edit and then the filename (with .m extension). 1 2 3 edit Or edit <filename> The above command will create the file in default MATLAB directory. If you want to store all program files in a specific folder, then you will have to provide the entire path. Let us create a folder named progs. Type the following commands at the command prompt (>>). 1 2 3 mkdir progs % create directory progs under default directory chdir progs % changing the current directory to progs edit prog1.m% creating an m file named prog1.m If you are creating the file for the first time, MATLAB prompts you to confirm it. Click Yes. Alternatively, if you are using the IDE, choose NEW -> Script. This also opens the editor and creates a file named Untitled. You can name and save the file after typing the code. Figure 2.5 Create an M-File. Type the following code in the editor: 1 2 3 4 5 6 7 NoOfStudents=6000; TeachingStaff=150; NonTeachingStaff=20; Total=NoOfStudents+TeachingStaff... +NonTeachingStaff; disp(Total); 46 INTRODUCTION TO MATLAB PROGRAMMING After creating and saving the file, you can run it in two ways: Clicking the Run button on the editor window or Just typing the filename (without extension) in the command prompt: >> prog1 The command window prompt displays the result: 1 6170 Example 2.5.10 Create a script file and type the following code. 1 2 3 4 5 a c d e f =5; b =7; = a + b = c + sin(b) =5* d = exp(-d) When the above code is compiled and executed, it produces the following result: 1 2 3 4 c d e f = = = = 2.5.5.2 12 12.657 63.285 3.1852e-06 MATLAB Toolboxes At USC, the following MATLAB toolboxes are available: Control Systems Fuzzy Logic Image Processing LMI Control Neural Networks Optimization Partial Differential Equation Robust Control Signal Processing Statistics Symbolic Math System Identification Wavelets To get into Toolbox\MATLAB Start menu\Toolboxes submenu, at that point -> Toolbox which you desire to utilize. PLOTTING Figure 2.6 2.6 47 How to add new toolbox to MATLAB. Plotting To plot a chart for capacity, make the accompanying strides: Define x for the determination of scope of qualities for the variable x, Define y as y = f (x) is the capacity calculation. Use the code plot(x, y) Code: 1 2 3 x=[0:5:100]; y = x; plot(x, y) Simulation result: Let us take one more example to plot the function y = x2 . In this example, we will draw two graphs with the same function, but in the second one, we will reduce the value of increment. Please note that as we decrease the increment, the graph becomes smoother. 48 INTRODUCTION TO MATLAB PROGRAMMING Create a script file and type the following code: 1 2 3 4 x=[12345678910]; x=[-100:20:100]; y= x.ˆ2; plot(x, y) Simulation result: Change the code file a little, reduce the increment to 5. Code: 1 2 3 x=[-100:5:100]; y = x.ˆ2; plot(x, y) Simulation result: 2.6.1 Including Various Types of Graphs MATLAB enables the inclusion of title, marks x-hub and y-pivot and network lines. X-label and y-label orders create names x-pivot and y-hub. The title will be displayed in the chart. The framework enables lattice in the output to be displayed. The pivot rises to charge permits creating the plot. The hub square order is the process which is used to create a square plot. PLOTTING 49 Example 2.6.1 Create a script file and type the following code 1 2 3 4 x =[0:0.01:10]; y = sin(x); plot(x, y), xlabel(’x’), ylabel(’Sin(x)’), title(’Sin(x) Graph’), grid on, axis equal MATLAB generates the following graph 2.6.2 Creation of a Multiple Number of Functions in a Similar Graph Draw various diagrams in a similar plot. Make a content document and sort the accompanying code. Example 2.6.2 Create a script file and type the following code. 1 2 3 4 x =[0:0.01:10]; y = sin(x); g = cos(x); plot(x, y, x, g,’.-’), legend(’Sin(x)’,’Cos(x)’) MATLAB generates the following graph 50 INTRODUCTION TO MATLAB PROGRAMMING 2.6.3 Creating a Graph According to Various Colors MATLAB provides eight basic color options for drawing graphs. The following table shows the colors and their codes. Table 2.8 Setting colors. Code Color w White k Black b Blue r Red c Cyan g Green m Magenta y Yellow Example 2.6.3 Let us draw the graph of two polynomials. f (x) = 3x4 + 2x3 + 7x2 + 2x + 9 and g(x) = 5x3 + 9x + 2 Create a script file and type the following code 1 2 3 4 x=[-10:0.01:10]; y= 3*x.ˆ4 + 2 * x.ˆ3 + 7 * x.ˆ2 + 2 * x + 9; g= 5 * x.ˆ3 + 9 * x + 2; plot(x, y,’r’, x, g,’g’) When you run the file, MATLAB generates the following graph. UNCOMMON FUNCTION 2.7 51 Uncommon Function To play out an undertaking, capacity is a gathering together of explanations, and the sizes are characterized in independent records in MATLAB. The record name and the size ought to be the same in MATLAB capacities [10]. Nearby workspace is characterized as the capacities work without anyone else’s workspace. Base workspace is characterized as discrete from the workspace summon incite. Punctuation of a capacity proclamation is function[out1,out2,.., outN]=myfun(in1,in2,.., inN) Example 2.7.1 The following function named mymax should be written in a file named mymax.m. It takes five numbers as an argument and returns the maximum of the numbers. Create a function file, named mymax.m and type the following code in it. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 function max =mymax(n1, n2, n3, n4, n5) %Thisfunction calculates the maximum of the % five numbers given as input %------------------------------------------------------------------max = n1; if(n2 > max) max = n2; end if(n3 > max) max = n3; end if(n4 > max) max = n4; end if(n5 > max) max = n5; end The principal code of capacity begins with catchphrase work. It works to provide the suitable name of the capacity which requests contentions. Here, the program work has 5 information contentions and 1 yield contention. 1 help mymax OUTPUT 1 2 This function calculates the maximum of the five numbers are given as input You can call the function as CODE 1 mymax(34, 78, 89, 23, 11) OUTPUT 1 ans = 89 52 INTRODUCTION TO MATLAB PROGRAMMING Unknown capacity is characterized inside a solitary MATLAB proclamation, and in customary programming dialects, it resembles an inline work. This capacity contains any number of info and yield contentions, and it is a solitary MATLAB articulation. An unknown capacity can be characterized at the right of the MATLAB order line or inside a capacity or content. The linguistic structure for making a mysterious capacity from an articulation is 1 f = @(arglist)expression Example 2.7.2 Here we will write an anonymous function named power, which will take two numbers as input and return the first number raised to the power of the second number. Create a script file and type the following code in it. 1 2 3 4 5 power =@(x, n) x.ˆn; result1 =power(7,3) result2 =power(49,0.5) result3 =power(10,-10) result4 = power (4.5,1.5) When you run the file, it displays 1 2 3 4 2.8 result1 result2 result3 result4 = = = = 343 7 1.0000e-10 9.5459 Executable Files Generation As an alternative to the charge line system, you can fabricate a free executable with the convey device Graphical User Interface. At the MATLAB incite, enter convey apparatus. This dispatches a trade box, inciting you to describe an endeavor name for this autonomous shape. Supplant the "untitled1.prj" with your favored endeavor name, for instance, "myStandalone.prj." There are two tabs: the default newer tab will present in one side and on the other side you can see an Open tab. Here Open tab consists of some existing exercises for adjustment [19]. The accompanying images were created with MATLAB R2013a3 . 3 https://www.mathworks.com/help/matlab/release-notes-R2013a.html EXECUTABLE FILES GENERATION Figure 2.7 53 Initializing deploy tool in MATLAB. Remember to replace the undertaking name untitled1.prj with your name decision, as myStandalone.prj. After pressing OK, the following discourse box shows up... Figure 2.8 Initializing standalone application. Press Add precise record prompts for the essential report name and its zone, for our purpose myStandalone.m in the present registry. The photograph above shows Removes major archive in light of the way that the precise record has quite recently been incorporated. The executable will be named, as usual, myStandalone. The Package tab exhibits what to make for this specific shape. Additional records and coordinators related with this errand may be entered by pressing the Add archives/envelopes. Here, the myApp.m has been incorporated. Frequently, the undertaking acknowledged will require you to open all instrument compartments. Tap the right-most (Actions) image (trailed by Settings, by then Toolboxes on Path) if you have to dismiss some of them. Futile apparatus compartments could save arrange time and memory accumulating. 54 INTRODUCTION TO MATLAB PROGRAMMING Figure 2.9 Initilazing toolboxes required. At the point when all the central records and envelopes required for the errand have been described, you may keep on constructing the executable by tapping on the farthest left light blue Build image (with two downward hits) near the upper right of the trade box. 2.9 Calling and Accumulating Executable Documents This technique is the easiest method to incorporate MATLAB content into an independent executable. The means are depicted utilizing the accompanying example content, find R.m: 1 2 3 4 5 6 function R = findR % findR - given data T, Calculate R %------------------------------------------------------------------T = 10; R =.5 * (-9.8)*T %end of MATLAB Code Complete these steps to compile the sample script: 1. Load the modules: 1 2 % module load matlab %module load gcc/4.7.3 # or later 2. If this is the first time you are using MATLAB to create an executable, run: 1 2 3 %matlab -nodisplay >>mbuild -setup >>exit 3. Compile the script into an executable. At the Linux or MATLAB prompt, run: 1 %mcc -m findR.m -o findR CALLING OBJECTS FROM EXTERNAL PROGRAMS 55 Two records are made: An executable: findR A shell content: run_findR.sh To run the executable, add the accompanying lines to your PBS content or run them at the Linux incite: 1 2 3 %module load matlab/2016b %module load gcc/4.7.3 ./run_findR.sh $MATLAB The output will be: 1 2 3 4 5 6 7 % ./run_findR.sh $MATLAB %------------------------------------------------------------------% Setting up environmental variables %------------------------------------------------------------------LD_LIBRARY_PATH is ./your path R = Value 2.10 Calling Objects from External Programs The Microsoft Component Object Model (COM) gives a structure to planning parallel programming parts into an application. Since these parts are completed in accordance with the organized code, those code are created by programming vernaculars which provide assistance Component Object Model. Table 2.9 Calling objects functions. actxserver Create a COM server actxcontrol Create Microsoft ActiveX control in the figure window actxcontrollist List currently installed Microsoft ActiveX controls actxcontrolselect Create Microsoft ActiveX control from UI eventlisteners List event handler functions associated with COM object events methodsview View class methods registerevent The associated event handler for COM object event at run time unregisterallevents Unregister all event handlers related to COM object events unregisterevent Unregister event handler associated with COM object event at run time iscom Determine whether the input is COM or ActiveX object isevent Determine whether the information is COM object event isinterface Determine whether the information is COM interface 56 INTRODUCTION TO MATLAB PROGRAMMING 2.11 JAVA Classes You can access existing Java classes to use in the MATLAB workspace. For example, built-in class packs, such as java.util, can be used, which are included in the Java lingo. See your Java vernacular documentation for delineations of these packs. Furthermore, you can access classes described in solitary class reports, packages, or Java archive (JAR) records, including types you create. 4 Table 2.10 import Java class functions. Add package or class to current import list isjava Determine if the input is Java object javaaddpath Add entries to dynamic Java class path javaArray Construct Java array object javachk Error message based on Java feature support javaclasspath Return Java class path or specify the dynamic path javaMethod Call Java method javaMethodEDT Call Java method from Event Dispatch Thread (EDT) javaObject Call Java constructor javaObjectEDT Call Java constructor on Event Dispatch Thread (EDT) javarmpath Remove entries from dynamic Java class path usejava Determine if Java feature is available Capture error information for Java exception: matlab.exception.JavaException 2.12 The Guide This case exhibits and makes use of a GUIDE to create an application. The following zones guide you through the route toward making this application. In case you need to oversee as well as execute the code, create the current envelope [6]. CODE: 1 2 3 4 copyfile(fullfile(docroot, ’techdoc’, ’creating_guis’))... ’examples’, ’simple_gui*.*’)), fileattrib(’simple_gui*.*’, ’+w’); control ’simple_gui.fig’; alter simple_gui.m OUTPUT 4 https://www.tutorialspoint.com/java/java exceptions.htm THE GUIDE 2.12.1 Open a New User Interface Step 1- Initiate the GUIDE by composing GUIDE at inciting. Step 2 - In GUIDE Blank GUI (Default) template OK. Step 3 - Display the names of the parts in the segment palette: Select File\Preferences\Guide Select Show names in part palette. Click OK. 57 58 INTRODUCTION TO MATLAB PROGRAMMING 2.12.2 Guide Window Size Setting Set the size of the user interface window by resizing the grid area in the layout editor. Click the lower-right corner of the layout area and drag it until the user interface is the desired size. 2.12.3 Design the User Interface Include, adjust, as well as mark the parts in the User Interface. Create three push buttons in the User Interface. THE GUIDE 59 Create rest of the segments to the User Interface – A static content territory – A pop-up menu – A tomahawk Organize sections according to the figure. Resize the tomahawks part roughly two-by-two inches. 2.12.4 Adjust the Components In the event that a few fragments have a comparable parent, the Alignment Tool is used to change them to each other. Choose each of the three push buttons catches and press Ctrl to monitor. Choose Tools is higher than Aligning Objects. Left-adjusted in the level course. Twenty pixels are dispersed among push button catches in the vertical bearing. 60 INTRODUCTION TO MATLAB PROGRAMMING Give OK. 2.12.5 Mark the Push Buttons Every push catch indicates a plot to compose: surf, work, as well as form. Here, the segment demonstrates the best practices for marking traps with alternatives. 1. Choose View is higher than the Property Inspector. 2. Layout area -> top push button. 3. Property Inspector -> String property replaces with Surf. 4. Give ENTER. Then you can see that the push button looks the same as Surf. Then follow the same procedure to change the second push button to Mesh and third push button to Contour. THE GUIDE 2.12.6 61 Menu Items-Rundown Pop-Up Step 1 - Pop-up menu Item gives you an option for three instructive accumulations, which are primarily zeniths, secondly layer, and finally sinc. By using a comparable name, we can identify the MATLAB components in the enlightening lists. This section presents a widely recognized technique which can be listed to those instructive accumulations as a pop-up menu option. Step 2 - Go to Property Inspector, catch String. You can get the String talk box. Step 3 - Delete the old content and type the new content peaks, membrane, and sinc. Give OK. Step 4 - Peaks is the first items which we have given as an input, which will then appear first in the pop-up menu. 2.12.7 Static Test Alteration Procedure in MATLAB Step 1 - In this User Interface (UI), the static substance gives a name for the pop-up menu in MATLAB. Those regions provide us legitimate philosophies to modify the test substance to examine Select Data. 62 INTRODUCTION TO MATLAB PROGRAMMING Step 2 - From the format region, select the static content, and go to the Property Inspector, tap catch by String option. There supplant present substance by articulation Select Data. Step 3 - Then Give OK. Now you can see that the term Select Data is displayed in the static text component, which is present in the upper portion of the pop-up menu. 2.12.8 Spare the Layout While saving the configuration, GUIDE makes two types of records, the first one is a FIG-archive record and the second one is a code record. In the case of code record, which is represented in the file format of .m, MATLAB employs limits which are used to monitor the applications. Step 1 - Save it, then run it by picking (Tools > Run). Step 2 - GUIDE introductions talk-box appearing: It will initially save the changes which are present in the figure and also in the MATLAB program. In case you need to continue answer Yes. Step 3 - Then GUIDE shows a Save As option and gives a FIG-report name. Step 4 - Here you can browse any envelope to take benefits, and then give the file name as simple_gui, which is the graphical user interface for the FIGrecord. Then GUIDE will automatically save all the details in the given name only in the future. THE GUIDE 63 Step 5 - Use the envelope to save the report. GUIDE provides an option to change the present coordinator in the talk box. Step 6 - GUIDE recovers records in both the .fig file and the .m file, and a while later runs the code. Then it opens the program record in the editor. Here we will get another window. There is no menu bar and toolbar. In this situation, we have to create our menu bars and toolbars, which is usually done for a GUIDE application. Figure 2.10 Inspecting MATLAB GUI. There is a procedure which can run the application without opening the GUIDE, by typing the file name we can run it. Here run command can also be used to run the code 1 Command - run simple_gui 2.12.9 Behavior of the App While saving the program in a past zone, first we have to save the Layout; here GUIDE provides two archives which are FIG-record and program record. We created the FIG-record file as simple_gui.fig, and the program record file is named simple_gui.m. In any case, the application isn’t authorizing because simple_gui.m doesn’t hold any declarations which can be used to do exercises. This part shows the appropriate procedure to insert code to record and to create a useful application. 2.12.10 Produce Data to Plot in MATLAB The fragment provides many acknowledged strategies to create data and plot it at the time when the customer clicks catch. The starting limit creates the data by MATLAB 64 INTRODUCTION TO MATLAB PROGRAMMING limits calling function. Starting limit presents User Interface when it gets started, which is essential for every GUIDE-made code archive process. For these kinds of situations, we can incorporate code which makes three educational records to the opening limit. These limits are apexes, film, and sinc. Step 1 - MATLAB Editor will display the opening limits. In this case record, the .m file doesn’t start when it is opened in the administrator, but it is opened from the Layout Editor by picking the great condition View > Editor. Step 2 - EDITOR tab -> NAVIGATE territory -> click Go To, then after -> choose simple_gui_OpeningFcn. The code is present in the opening limit, and the cursor moves there: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 %--------------Executes just before simple_gis made visible-------Function simple_gui_OpeningFcn(hObject,event data,handles,varargin) %This function has no output args, see OutputFcn %hObject handle on figuring %eventdata reserved - to be defined in a figure version of MATLAB %handles structure with handles and user data (see GUIDATA) %varargin command line arguments to simple_g(see VARARGIN) %------------------------------------------------------------------%Choose default command line output for simple_gui Handles.output = hObject; %Update Handles Structure Guidata((hObject, handles); %UIWAIT makes simple_gwait for user response (see UIRESUME) %uiwait(handles.figure1); By adding the code given below, we can create the data to plot in the opening function after the line starts with the symbol (%) varargin... CODE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 %------------------------------------------------------------------%Create the data to plot. %------------------------------------------------------------------Handle.peaks = peakes(35); Handles.membrane = membrane; [X,Y] = meshgrid(-8:.5:8); R = sqrt(x.ˆ2+y.ˆ2) + eps; Sinc = sin(r) ./r; Handles.sinc= sinc; %------------------------------------------------------------------% set the current data value %------------------------------------------------------------------Handles.current_data = handle.peaks; Surf(handles.current_data) These codes make use of the MATLAB limits apexes, layer, and sinc. Here the handles structure will store the data. This helps to recover data from handles structure. THE GUIDE Figure 2.11 2.12.11 65 Simple GUI. Pop-Up Menu Characteristics Step 1 - Fly-up menu bar provides decisions on data plotting. Precisely, the client picks three plots. Step 2 - MATLAB Editor shows the pop-up menu callback. Step 3 - GUIDE Layout shown below. Figure 2.12 Selecting callback options. GUIDE PROCEDURE 1 2 3 4 5 6 GUIDE demonstrates the code record in the editor and moves the cursor to the pop-x callback, which contains this code: %------------------------------------------------------------------%- Executes on assurance change in popupmenu1 %------------------------------------------------------------------Work popupmenu1_Callback(hObject, eventdata, handles) 66 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 INTRODUCTION TO MATLAB PROGRAMMING %------------------------------------------------------------------%hobject handle to popupmenu1 (see GCBO) %eventdata held -to be described in a future adjustment of MATLAB %handles structure with handles and customer data(see GUIDATA) %------------------------------------------------------------------Add the going with the code to the popupmenu_Callback after the comment that begins handles This code at first recoups two flies up menu properties: .String-a telephone show that contains the menu substance .Value-the record into the menu substance of the picked enlightening accumulation The code by then uses a change explanation to make the picked instructive gathering present data. The last decree saves the movements to the handles structure. %------------------------------------------------------------------%Determine the chose informational collection. %------------------------------------------------------------------Str=get(hObject,’String’); Val =get(hObject,’Value’); %------------------------------------------------------------------%Set current information to the chose informational index. %------------------------------------------------------------------Switch str{val}; %User chooses tops. Case ’crests; Handles.current data=handles.peaks; %User chooses layer. Case ’film’ Handles.current data=handles.membrane; %User chooses sinc. Case ’sinc’ Handles.current data=handles.sinc; End %Save the handles structure. Guidata(hObject.handles) 2.12.12 Behavior of Push Button Every push button gets substitute kind of plot using information demonstrated with the help of the present decision in the pop-up menu. The handles structure provides the callbacks to the push button, after that they are ready to plot. Surf button gets callback right-tap Surf push, later View Callbacks -> Callback. PROCEDURE 1 2 3 4 5 6 In the Editor, the cursor moves to the Surf push catch callback in the code document, which contains this code: %------------------------------------------------------------------%-Executes on catch press in pushbutton1. %------------------------------------------------------------------Function pushbutton1_Callback(hObject,eventdata,handles) EFFECTIVE PROGRAMMING THROUGH MATLAB 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 67 %hObjectbhandle to pushbutton1(see GCBO) %eventdata saved-to be characterized in a future variant of MATLAB %handles structure with handles and client information (see GUIDATA) Add the accompanying code to the callback instantly after the remark that starts %handles %------------------------------------------------------------------%Display surf plot of the as of now chose information. %------------------------------------------------------------------Surf(handles.current data); Rehash stages 1 and 2 to add comparable code to the Mesh and Contour push catch callbacks. .Add this code to the Mesh push catch callback, pushbutton2_Callback: %------------------------------------------------------------------%Display work plot of the at present chosen information. %------------------------------------------------------------------Mesh(handles.current data); Add this code to the Contour push catch callback, pushbutton3_Callback: %------------------------------------------------------------------%Display shape plot of the as of now chose information. %------------------------------------------------------------------Sparse your code by choosing File>Save. Figure 2.13 2.13 Selecting callback options 2. Effective Programming through MATLAB Strategies to Improve the Performance in MATLAB. To increase the speed of execution of the system, the following conditions are used. 68 INTRODUCTION TO MATLAB PROGRAMMING 2.13.1 Condition Think about establishing frames that offer computational resources as well as which help to reduce the execution time of the code. Code Structure: Step 1 - Utilize works as opposed to substance. Limits are all things considered speedier. Step 2 - Prefer adjacent limits over settled limits. Utilize this kind of preparation particularly in the case where the boundaries are not responsible for the factors in the essential limit. Step 3 - Utilize disconnected programming to create a useful programming model in MATLAB. This type of preparation is used to reduce running costs. 2.13.2 Practice Programs This method of practice programs is used to improvise the execution of the program. Step 1 - Pre-allocation – Rather than reliably dynamic sizing displays, think about pre-allocation of most proportions with the room needed for a group. For the required additional information, you can look at Pre-allocation. Step 2 - Vectorize – Rather than creating a circular structure of the program, think about the MATLAB system as well as vector assignments. When additional information is required, you can look at Vectorization. Step 3 - Place free undertakings out of the coverage area of the circles – In case the code fails to survey with some other route with each circle accentuation, shift it out of the hover to reduce the redundant computations. Step 4 - Build newer factors while data gets modified – Build another variable as opposed to consigning data of a substitute sort to a present variable. By changing the class or display condition of a current variable, it gives additional chance to process. Step 5 - Use cut off – Use short-circuiting true-blue heads, && and ||, when possible. Short circuiting is more capable in light of the way that MATLAB surveys the second operand precisely when the fundamental operands are not managing the results. For required additional information, you can look at Logical Operators: Short Circuit. Step 6 - Stay away from overall components – The usage of global elements has to be minimized to get the standard programming practices. Also, the global variable can lessen execution. Step 7 - Stay away from overloading amassed ins – Stay away from overcomplicated works which limit data classes. CLONES PROCESS USING MATLAB 69 Step 8 - Stay away from the usage of “data as code” – In a case where you can provide free parts of code (e.g., more than 500 lines) which create factors among steady characteristics, think about building the variables as well as saving them in MATLAB-record. Now, instead of execution, we can use the stack option to generate them. 2.13.3 Specific Functions in MATLAB There are specific MATLAB limits when executing the first program. Step 1 - Stay away from clearance of a maximum number of code that would regularly be fitting. Do whatever it takes not to make use of clear all. For required additional information, you can look at clear. Step 2 - Stay away from limits in the inquiry domain; the ideology of runtime is computationally costly. Step 3 - Stay away from limits for instance, and eval. Utilize limit handle commitment to feval at whatever point promising. Step 4 - Stay away from programmed usage of the conservative circle, (addpath), as well as (rmpath), at the time of suitable situations. Modifying the path during runtime results in code recompilation. 2.14 Clones Process Using MATLAB For a few areas in number-theory, material sciences, architecture, financial sectors, and the unique regions including high-dimensional numeric portion, the introduction to program considered by using MATLAB. Nevertheless, MATLAB is one of the select instruments. Here you can get understanding and modification process of the code without accessing the source code. These are the essential factors of the cloning process using MATLAB. 2.14.1 GNU Octave Another choice preferred by MATLAB is GNU Octave. It has been an excellent change for pretty much three decades; GNU Octave continues running on Windows operating system, Mac operating system, and Linux operating system as well as being used mostly in several genuine allotments. If you’re searching for an endeavor which is nearer to authentic MATLAB lingo, GNU Octave is a possible active counterpart in general; since it tries rectification likeness, tremendous quantities of your undertakings made for MATLAB can also continue running in GNU Octave without alteration, making it indispensable. GNU Octave consists of an extensive variety of choices open for a front-end association by conveys with frame 4; some take after MATLAB’s interface more than 70 INTRODUCTION TO MATLAB PROGRAMMING the other software. GNU Octave’s Wikipedia page records a couple of options. GNU Octave got approval in GPL, and you can also get the codes about this concept on the GNU FTP site. 2.14.2 Scilab Scilab is another open source software elective in favor of numerical assuming which continues running over every critical stage: Windows operating system, Mac operating system, and Linux operating systems are incorporated. It is in a general sense the same as MATLAB in its use, improve the proximity isn’t a target of the endeavor’s specialists [20]. Scilab got approval in GPL, and you can also get the codes about this concept in the assignment site. 2.14.3 Sage Sage is another open source number juggling programming method and is a better than average choice for those searching for a MATLAB elective. It’s based on a combination of known Python-based sensible enrolling libraries and provides its particular language which is parallel with Python concepts. It consists of various features which bring together line interface, program diaries, gadgets used for embedding in multiple files, and, obviously, various numerical libraries. It got approval in GPL, and you can also get the codes concerning this concept on the Endeavor site. Here we present details about some other open source instruments which you may need to consider: FreeMat5 is one of the open source software and GPL-approved condition for outlining legitimate prototyping. This package can be operated in the Linux operating system and Microsoft’s operating system OS X and Windows. The latest version of this software was released in 2013. Genius Mathematics Tool6 is one of the open source software, a viably made small-scale PC program, and research instrument. The language which is used for Genius Mathematics Tool is Genius Extension Language. This package can be operated in the Linux operating system and Unix Personal Computers. Maxima7 is one of the open source software, which is most frequently used as a most differentiating alternative to MATLAB. It relies upon Macsyma, a “stunning PC polynomial math structure” developed at MIT in the 1960s. This package can be operated in the Linux operating system, and Microsoft’s operating system OS X and Windows. 5 www.freemat.info/ 6 https://www.linuxlinks.com/genius/ 7 maxima.sourceforge.net/ PARALLEL MATLAB SYSTEM 71 NumPy8 is one of the open source software with a package that includes a maximum number of the features of Python. It acts as an essential key for SciPy Stack; its package consists of math, science, and building programming-based Python concepts. NumPy got approval from BSD. This package can be operated in the Linux operating system, and Microsoft’s operating system OS X and Windows. SymPy9 is one of the open source software which was approved by BSD for an exact science. It is intended for use in all types of PCs running Python version 2.7 or above. It intends to finish PC polynomial math system; has a working change connect with precise releases; and is used in various diverse errands (checking SageMath, above). 2.15 2.15.1 Parallel MATLAB System Run a Batch Job This case uses the for-hover from the past case, inside a substance [13, 14]. 1. To create the script, type: 1 edit mywave 2. In the MATLAB Editor, enter the text of the for-loop: 1 2 3 for i=1:1024 A(i)=sin(*2*pi/1024); end 3. Save the record and close the Editor. 4. Use the cluster order in the MATLAB Command Window to run your content on a different MATLAB specialist: 1 job=batch(’mywave’) 5. The cluster summons does not square MATLAB, so you should sit tight for the activity to complete before you can recover and see its outcomes: 8 https://www.numpy.org/ 9 https://www.sympy.org/ 72 INTRODUCTION TO MATLAB PROGRAMMING 1 wait(job) 6. The heap charge exchanges factors made on the laborer to the customer workspace, where you can see the outcomes: 1 2 load(job,’A’) plot(A) 7. When the job is complete, permanently delete its data and remove its reference from the workspace: 1 2 delete(job) clear job Batch runs your code on a local worker or a cluster worker, but does not require a parallel pool. You can use batch to run either scripts or functions. For more details, see the batch reference page. 2.15.2 Run a Batch Parallel Loop You can enhance the abilities to offload employment and run a parallel circle. In the previous two representations, you balanced a for-hover to make a parfor-circle, and you have referenced a for-hover as group work. This case merges the two to make a bunch parfor-circle [15, 16]. 1. Open your content in the MATLAB Editor, to create a script, type: 1 edit mywave 2. Adjust the content so that the explanation is a part for articulation: 1 2 3 parfor i=1:1024 A(i)=sin(i*2*pi/1024); end 3. Save the file and close the Editor. 4. Run the content in MATLAB with the bunch summon as previously, yet demonstrate that the content should utilize a parallel pool for the circle: 1 job=batch(’mywave’,’pool’,3) This charge demonstrates that three workers (despite the one running the gathering content) are to evaluate the circle cycles. Subsequently, this case uses all four adjacent workers, including the one authority running the group content. There are five MATLAB sessions required, as shown in the following diagram. PARALLEL MATLAB SYSTEM 73 5. To view the results: 1 2 3 wait(job) load(job,’A’) plot(A) The results look the same as before. However, there are two essential differences in execution: The work of portraying the parfor circle and assembling its results are offloaded to another MATLAB session by the cluster. The circle cycles are scattered beginning with one MATLAB master then onto the following plan of workers running at the same time (’Pool’ and parfor), so the circle may run faster than when having only a solitary pro execute it. 6. When the job is complete, permanently delete its data and remove its reference from the workspace: 1 2 2.15.3 delete(job) clear job Current Folder Browser - Run Script as Batch Job Pack work continues running on the gathering recognized by the default bundle profile. The going with figure exhibits the different menu option to run the substance record script1.m: 74 INTRODUCTION TO MATLAB PROGRAMMING Figure 2.14 Running script as batch job. Running a substance as a cluster from the program uses only a solitary pro from the gathering. So, paying little mind to whether the substance contains a parfor circle or spmd square, it doesn’t open a new pool of experts on the pack. These code squares execute on the single master used for the group work. If your cluster content requires opening a new pool of experts, you can run it from the call line, as delineated in Run a Batch Parallel Loop. When you run a gathering work from the program, this opens the Job Monitor. The Job Monitor is an instrument that allows you to track your movement in the scheduler line. For more information about the Job Monitor and its abilities, see Job Monitor. 2.16 Conclusion The main motto of the chapter is to maintain the consistency of the technology distribution of the network using MATLAB and the syntax implementations of MATLAB. This chapter dealt with the explanation of different syntax formats of MATLAB and its different features. Different formats and notations are explained which will be helpful for understanding MATLAB implementation in network simulation. Simulation is used to understand the importance of import and export operations and other simple scenarios which we need to consider while learning the network operations. All these scenarios are explained in this chapter and the important elements of MATLAB, including with basics, are also explained. Students can get complete knowledge on the subject along with the basics of network modeling with MATLAB. CONCLUSION 75 REFERENCES 1. Kharab, A., & Guenther, R. (2018). An introduction to numerical methods: a MATLAB approach. CRC Press. 2. Martinez, W. L., & Martinez, A. R. (2007). Computational statistics handbook with MATLAB. Chapman and Hall/CRC. 3. Moore, H. (2017). MATLAB for Engineers. Pearson. 4. Schmidt, J. D. (2010, July). Numerical simulation of optical wave propagation with examples in MATLAB. Bellingham, Washington, USA: SPIE. 5. Hanselman, D. C., & Littlefield, B. (2005). Mastering Matlab 7. Pearson/Prentice Hall. 6. Holland, O. T., & Marchand, P. (2002). Graphics and GUIs with MATLAB. Chapman and Hall/CRC. 7. Smith, D. M. (2010). Engineering Computation with MATLAB. Boston: Addison/Wesley, 8. Quinquis, A. (2008). Digital signal processing using MATLAB. Wiley-IEEE Press. 9. Messner, W. C., Tilbury, D. M., & Hill, A. P. R. (1999). Control Tutorials for MATLAB and Simulink. 10. Herniter, M. E. (2000). Programming in MATLAB. Brooks/Cole Publishing Co. 11. Choy, R., & Edelman, A. (2005). Parallel MATLAB: Doing it right. Proceedings of the IEEE, 93(2), 331-341. 12. Trefethen, A. E., Menon, V. S., Chang, C. C., Czajkowski, G., Myers, C., & Trefethen, L. N. (1996). MultiMATLAB: MATLAB on multiple processors. Cornell University. 13. Travinin Bliss, N., & Kepner, J. (2007). pMATLAB Parallel MATLAB Library. The International Journal of High Performance Computing Applications, 21(3), 336-359. 14. Kepner, J., & Travinin, N. (2003). Parallel MATLAB: The next generation. MASSACHUSETTS INST OF TECH LEXINGTON LINCOLN LAB. 15. Choy, R., & Edelman, A. (2003). Matlab* P 2.0: a unified parallel MATLAB. 16. Bulej, V., Urek, J., Eberth, M., Kuric, I., & Stanek, J. (2019). Modelling and Simulation of Machine Tool Prototype with 6DOF Parallel Mechanism in Matlab/Simulink. In MATEC Web of Conferences (Vol. 254, p. 03002). EDP Sciences. 17. Luszczek, P. (2009). Parallel programming in MATLAB. The International Journal of High Performance Computing Applications, 23(3), 277-283. 18. https://www.mathworks.com/ 19. https://www.tutorialspoint.com/matlab/matlab overview.htm 20. https://en.wikipedia.org/wiki/Scilab CHAPTER 3 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB Abstract In this chapter, we explain how digital communication system simulations can be performed using MATLAB. We provide a detailed introduction to digital communications, i.e., data transmission with example. Next, a detailed explanation is given of simulation of Rayleigh Fading Model, BPSK modulation and demodulation, QPSK modulation and demodulation along with their MATLAB coding and show the output as well. We also explain Image Error Rate vs Signal-to-Noise Ratio and OFDM with sample MATLAB coding and their productions. Keywords: Digital communication, Rayleigh fading model, BPSK, QPSK, image error rate, signal-to-noise, OFDM framework Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 77 78 3.1 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB Introduction to Digital Communication Transmitting information in discrete messages takes into account more prominent signal handling capacity. The capacity to process an interchange signal implies that mistakes caused by uneven rules are distinguished as well as solved. Advanced signs are otherwise tested sooner and continuously observed, and different symbols are multiplexed mutually for shaping signal. Here is an outline of what will be covered in this chapter. 1. Information Transmission: Channel qualities, signaling techniques, obstruction and commotion, and synchronization; 2. Data Sources and Coding: Information hypothesis, coding of data for productivity and error security encryption; 3. Signal Representation: Representation of discrete time motions in time and recurrence, z-change and Fourier transformations, the distinct estimate of constant signs, examining and quantization and information pressure; 4. Sifting: Analysis and combination of separate time channels; limited motivation reaction and interminable drive reaction channels, recurrence reaction of digital channels, shafts, and zeros, channels for connection and identification, coordinated channels and stochastic signals and clamor forms; 5. Computerized Signal Processing Applications: Processing of pictures utilizing advanced procedures [1, 2]. The utilization of DCSP in industry and our day-to-day life is enormous, even though in this basic module we are just ready to address a few straightforward cases. Many thanks go to Dr. Enrico Rossoni, who has invested an impressive amount of energy in looking over the original copy a few times to amend the grammatical errors. The incorporated segments are just for one’s reference [3, 7, 9]. 3.1.1 Data Transmission A correspondences framework is in charge of the transmission of data from the sender to the beneficiary. At its least complex, the frame contains (see Figure 3.1): Figure 3.1 Data transmission system. INTRODUCTION TO DIGITAL COMMUNICATION 79 1. For physically proper transmission channel, a modulator that takes the source signal and changes it. 2. A transmission channel that is the physical association passing between the parties. 3. A transmitter that genuinely carries the adjusted signal into the channel, generally speaking, opening up the signal as it does all things being considered. 4. A recipient that perceives the transmitted signal on the circuit and as a general rule strengthens it (as its track will have debilitated it through the channel). From the signal received, a demodulator gets the first source motion and passes it to the sink. At each stage, signal handling procedures are required to distinguish signals, sift through the commotion and concentrate highlights, as will be examined in the second part of the chapter. Advanced information is spoken to in all respects by a series of 1s or 0s. Every one or zero is alluded to as a bit. Regularly, yet not generally, these bit strings are translated as numbers in a parallel number framework. In this way, (1010012 = 4110 ), the data substance of a computerized signal is equivalent to the number of bits required to speak to it. Along these lines, a signal that may change somewhere in the range of 0 and 7 has a data substance of 3 bits. Composed as a condition this relationship is I = log2 (n) bits (3.1) where n is the number of levels a signal may take. Note that data is a proportion of the number of different results taken. The data rate is a proportion of the speed with which data is exchanged. It is estimated in bits/second or b/s. 3.1.2 Example Media communications movement is described by incredible decent variety. A nonrestrictive rundown is given below: Figure 3.2 Time domain and frequency domain representation of a signal. 80 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB 1. Sound signs: A sound signal is a case of a simple signal. It involves a recurrence extending from around 200 Hz to around 15 KHz. Discourse signals possess a small range of frequencies, and phone discourse normally involves the range of 300 Hz to 3300 Hz. The range of frequencies involved by the signal is called its data transmission (see Figure 3.2); 2. TV flag: A TV signal is a simple signal made by checking a two-dimensional picture. Ordinarily, the signal possesses a transfer speed of around 6 MHz; 3. Tele-text is composed (or drawn) interchanges that are deciphered outwardly. Wire portrays a message restricted to a foreordained arrangement of alphanumeric characters; 4. Repeating cells, in which the child cells’ DNA contains data from the parent cells; 5. Circle drives; 6. Our cerebrum. The utilization of computerized signs and adjustment has excellent points of interest over simple frameworks. These are: 1. High constancy. The discrete idea of digital signals makes their qualification within sight of commotion simple. High loyalty transmission and description are conceivable. 2. Time autonomy. A digitized signal is a flood of numbers. Once digitized a signal might be transmitted at a rate detached with its chronicle rate. 3. Source autonomy. The computerized signs might be transmitted utilizing a similar arrangement independent of the wellspring of the correspondence. Voice, video, and content might be sent using the same channel. 4. Signs might be coded. The same transmitted message has an endless number of implications as per the lead used to translate it. One load of electronic correspondence is the expanded cost of transmitters and recipients. This is especially valid for continuous communication of simple signs. 3.1.3 The Conversion of Analog and Digital Signals With a specific end goal to send simple signals over a computerized correspondence framework, or process them on an advanced PC, we have to change over simple signs to advanced ones. This procedure is performed by a simple-to-advanced converter (ADC). The simple signal is inspected (i.e., estimated at the frequently dispersed moment) (Figure 3.3) and after that quantized (Figure 3.4, a baseboard), i.e., changed over to discrete numeric qualities. The different activity to the ADC is performed by INTRODUCTION TO DIGITAL COMMUNICATION 81 a computerized-to-simple converter (DAC). A vital law represents the ADC procedure [8, 13-15]. Figure 3.3 Analog-to-digital conversion. The Nyquist-Shannon Theorem expresses that a simple signal of transfer speed B can be reproduced from its examined shape tests at a rate equivalent to no less than twice its transmission capacity. That is S ≥ 2B (3.2) The rate at which an ADC creates bits relies upon what number of bits is utilized in the converter. For instance, a discourse signal has an estimated transfer speed of 4 KHz. On the off chance that this is examined as 8-bit ADC at Nyquist testing rate, where R is given as the bit rate to change the signal without loss of data R = 8 bits × 2B = 64000 b/s (3.3) Figure 3.4 Upper panel: Periodic sampling of an analog signal. Bottom panel: Quantization of a sampled signal. 82 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB 3.1.4 Information, Bandwidth, and Noise One of the critical inquiries related to the correspondence channel provides the greatest rate for data exchange. Simple signals going through physical channels may not accomplish self-assertively quick changes. The data transmission dictates the rate at which a signal may change. To be specific, a signal of transfer speed B may change at a most extreme rate of 2B, so the highest data rate is 2B. On the off chance that progressions of contrasting greatness are each related to a different piece, the data rate might be expanded [6]. In this way, if each time the signal transforms, it can take one of the n levels, the data rate is extended to R = 2Blog2 (n) b/s (3.4) This equation expresses that as n watches out for vastness, so does the data rate. Is there a point of confinement on the number of levels? The nearness of clamor sets the farthest point. On the off chance that we keep on subdividing the size of the progressions into regularly diminishing interims, we achieve a point that can’t recognize entity levels due to the nearness of commotion. Commotion hence puts a breaking point on the most extreme rate data exchange. Here the true matters are the signal clamor proportion. This type of concept is characterized by proportion signal control S which can clamor control N, which is frequently communicated in decibels (dB): S dB (3.5) SN R = 10log10 N The wellspring of commotion signals changes broadly: 1. Info commotion is regular in low recurrence circuits and emerges from electric fields created by electrical exchanging. It shows up as blasts at the recipient, and when present can have a disastrous impact because of its huge power. Other individuals’ signs can produce commotion: crosstalk is the term surrendered to the pick of emanated signals from nearby cabling. At the point when radio connections are utilized, obstruction from different transmitters can be hazardous. 2. Warm commotion is continuously present. This is because of the arbitrary movement electric charges exhibit in all media. It tends to be produced remotely, or inside at the collector. The most extreme hypothetical to the rate at which the data disregards errors is not considered in a channel. It is known as the channel limit. Here, the well-known Hartley-Shannon Law says the channel limit, C, is given below S C = Blog2 1 + bps (3.6) N Here, a 10 KHz channel works in a signal-to-noise ratio of 15 dB and hypothetically has the most extreme data rate of 10000log2 (31.623) = 49828 b/s. The hypothesis puts forth no expression concerning how the channel limit is accomplished. Practically speaking, channels approach this farthest point. The undertaking of giving high channel productivity is the objective of coding procedures. SIMULATION OF RAYLEIGH FADING MODEL 3.2 83 Simulation of Rayleigh Fading Model Rayleigh fading is the name given to the type of fading that is frequently experienced in a situation where there is an expansive number of reflections display. The Rayleigh fading model uses a measurable way to deal with examining the spread and can be utilized in various situations. The Rayleigh fading model is regularly seen as a reasonable way to deal with taking when breaking down and forecasting radio wave proliferation execution for zones; for example, cell correspondences in a well-developed urban condition where there are many reflections from structures, and so on. HF ionospheric radio wave spread where reflections (or all the more precisely refractions) happen at numerous focuses inside the ionosphere is likewise another territory where Rayleigh fading model applies well. It is additionally fitting to utilize the Rayleigh fading model for tropospheric radio engendering because again there are many reflection points and the signal may take after a wide range of ways. The Rayleigh fading model is most pertinent to events where there is a wide range of signal ways, none of which are prevailing. Along these lines, all the signal ways will shift and can affect the general signal at the recipient [7]. 3.2.1 Rayleigh Fading Basics The Rayleigh Fading model is especially valuable in situations where the signal might be thought to be scattered between the transmitter and collector. In this type of situation, no single signal way overwhelms and a measurable approach is required for the examination of the general idea of the radio interchanges channel. Rayleigh fading is a model that can be utilized to portray the type of fading that happens when multipath spread exists. In any earthly condition, a radio signal will travel using various diverse ways from the transmitter to the collector. The most precise method is the direct or viewable pathway way. As there is frequent development of the transmitter or the beneficiary, this can make the way lengths change and the signal level will shift as needed. Moreover, if any of the items being utilized for reflection or refraction of any piece of the signal moves, at that point this too will cause variety. This happens because a portion of the way lengths will change and this will mean their relative stages will change, offering ascent to an adjustment in the summation of all the received signals. The Rayleigh fading model can be utilized to dissect radio signal proliferation on a factual premise. It works best under conditions when there is no common sign (e.g., coordinate viewable pathway signal), and in numerous events cell phones being utilized in a thick urban condition fall into this classification. Several cases where no overwhelming way by and large exists are for ionospheric engendering where the signal achieves the recipient using an immense number of individual styles. Spread utilizing tropospheric ducting likewise displays similar examples. In like manner, every one of these cases is perfect for the utilization of the Rayleigh fading or engendering model. 84 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB 3.2.2 Rayleigh Fading The deferrals related to various signal ways in a multipath fading divert change in an unusual way and must be described factually. Right when there is a large number of courses, beyond what many would consider possible speculation can be associated with showing the time-variety inspiration response of the channel as a complexregarded Gaussian discretionary process. At the point when the motivation reaction is demonstrated as a zero-mean complex-esteemed Gaussian process, the channel is said to be a Rayleigh fading channel [8]. The model behind Rician fading is like that for Rayleigh fading, with the exception that in Rician fading a prevailing stable segment is available. This overwhelming part can, for example, be the observable pathway wave. For our situation, the Rayleigh Fading model is expected to have just two multipath parts, X(t) and Y (t). Rayleigh Fading can be acquired from zero-mean complex Gaussian procedures (X(t) and Y (t)). Essentially, including the two Gaussian Random factors and taking the square root (envelope) gives a Rayleigh appropriated process. The stage takes after uniform conveyance. MATLAB Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 %-----------------------Input Section-----------------------------%Number of samples to generate N=1000000; % Variance of underlying Gaussian random variables Variance = 0.2; %------------------------------------------------------------------% Independent Gaussian random variables with zero mean and % unit variance %------------------------------------------------------------------X=randn(1,N); Y=randn(1,N); %------------------------------------------------------------------%rayleigh fading envelope with the desired variance %------------------------------------------------------------------R=sqrt(variance*(x.ˆ2+y.ˆ2)); %define bin steps and range for histogram plotting Step=0.1; range=0:step:3; %------------------------------------------------------------------%get histogram values and approximate it to get the pdf curve %------------------------------------------------------------------H=hist(r,range); %simulated PDF from the x and y samples approxPDF=h/(step*sum(h)); %------------------------------------------------------------------%Theoritical PdF from the Rayleigh fading equation %------------------------------------------------------------------Theoretical=(range/variance).*exp(-range.ˆ2/(2*variance)); Plot(range,approxPDF,’b*’,range,theoretical ,’r’); Title(’Simulation and theoretical rayleyigh PDF for variance=0.5’) Legend(’simulated PDF’,’theoretical PDF’) Xlabel(’r ->’); SIMULATION OF RAYLEIGH FADING MODEL 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 85 Ylabel(’p(r)->’); Grid; %------------------------------------------------------------------%PdF of phase of the Rayleigh envelope %------------------------------------------------------------------Theta=atan(y./x); Figure(2) %plot histogram of the phase part Hist(theta); %------------------------------------------------------------------%approximate the histogram of the phase part to a nice PDF curve %------------------------------------------------------------------[counts,range]=hist(theta,100); Step=range(2)-range(1); approxPDF=counts/(step*sum(counts)); %------------------------------------------------------------------%simulated PDF from the x and y samples %------------------------------------------------------------------bar(range,approxPDF,’b’); hold on plotHandle=plot(range,approxPDF,’r’); set(plotHandle,’LineWidth’,3.5); axis([-2 2 0 max(approxPDF)+0.2]) hold off title(’simulatedd PDF of phase of Rayleigh Distribution ’); xlabel(’\theta - ->’); ylabel(’’p(\theta) - ->’); grid; Using randn function in MATLAB two free indistinguishably appropriated Gaussian random arrays are created and the envelope of their sum is entirely computed to give Rayleigh fading process. To plot the pdf of the created process a histogram is used and its phase plot is likewise drawn. Simulation Results: Figure 3.5 Simulation results. 86 3.3 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB BPSK Modulation and Demodulation Double Phase Shift Keying (BPSK) [5] is a kind of automated direction strategy in which we send one piece for each image, i.e., ’0’ or a ’1.’ In this way, the bit rate and image rate are the same. Regarding a reference bearer, we can have a stage move of 0o or 180o , which relies on the message bit. For example, we can have the following with transmitted band-pass pictures: 2E cos(2πf t) → represents 1 (3.7) S1 = T 2E S2 = (3.8) cos(2πf t + π) → represents 0 T or 2E cos(2πf t) → represents 0 S2 = (3.9) T Where ’E’ is the image vitality, ’T’ is the image era and f is the recurrence of the transporter. We get a solitary orthonormal premise work utilizing Gram-Schmidt orthogonalization, and it is given as: 2 ϕ1 = cos(2πf t) (3.10) T 3.3.1 BPSK Modulation By and by, we can without a lot of a stretch see that the two waveforms of S0 and S1 are changed concerning each other and we can use the following intend to plot a BPSK modulator: Figure 3.6 BPSK modulator. BPSK MODULATION AND DEMODULATION 3.3.2 87 BPSK Demodulation We do sound demodulation of the BPSK movement at the recipient. Insightful demodulation requires the persuaded signal to be expanded with the transporter having indistinct repeat and stage from the transmitter. The stage synchronization is commonly an expert using Phase Locked Loop (PLL) at the beneficiary. PLL execution isn’t done here; rather we expect it comes full circle and organizes synchronization. Figure 3.7 BPSK demodulator. The square framework of BPSK modulator is shown in Figure 3.7. After the increase with the carrier (orthonormal commence work), the signal is constellated over the picture length ’T’ and tried. By then thresholding is associated with choose whether a ’1’ was sent (+ve voltage), or a ’0’ was sent (- ve voltage). The MATLAB generation code is given below. Here, for ease, the bit rate is settled to 1 bit/s (i.e., T = 1 second). It is also acknowledged that Phased Locked Loop (PLL) has quite recently achieved redress organize synchronization. CODE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 clear all; close all; %------------------------------------------------------------------% Nb is the number of bits to be transmitted % Bit rate is assumed to be 1 bit/s; %------------------------------------------------------------------T =1; %------------------------------------------------------------------% bits to be transmitted B = [1 0 1 0 1] %------------------------------------------------------------------% Rb is the bit rate in bits/second %------------------------------------------------------------------NRZ_out = []; RZ_out = []; Manchester_out = []; %------------------------------------------------------------------%Vp is the peak voltage +v of the NRZ waveform %------------------------------------------------------------------Vp = 1; %------------------------------------------------------------------%Here we encode input bistream as Bipolar NRZ - L waveform %------------------------------------------------------------------For index = 1:size(b,2) If b(index) == 1 NRZ_out = [NRZ_out ones(1,200)*Vp]; 88 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB Elseif b(index) == 0 NRZ_out = [NRZ_out ones(1,200)*(-Vp)]; End End %------------------------------------------------------------------% Generated bit stream impulses %------------------------------------------------------------------Figure(1); Stem(b); Xlabel(’Time (seconds) -- >’) Ylabel(’ Amplitude (Volts) ->’) Title(’Impulses of bits to be transmitted’); Figure(2); Plot(NRZ_out); Xlabel(’ Time (Seconds) ->’); Ylabel(’Amplitude (volts) ->’); Title(’Generated NRZ signal’); T =0.005:0.005:5; %------------------------------------------------------------------%Frequency of the carrier F = 5; %------------------------------------------------------------------%Here we generate the moduleted singal by multiplying it with %carrier (basis function) %------------------------------------------------------------------Moduled =NRZ_out.*(sqrt(2/T)*cos(2*pi*f*t)); Figure; Plot(Modulated); Xlabel(’Time (seconds) ->’); Ylabel(’Amplitude (Volts) -- >’); Title(’BPSKModulated Signal’); Y = []; %------------------------------------------------------------------%We begin demodulation by multiplying the received signal again with %the carrier (basis function) %------------------------------------------------------------------Demodulated = Modulated.*(sqrt(2/T)*cos(2*pi*f*t)); %------------------------------------------------------------------%Here we perform the integration over time period T using trapz %Integrator is an important part of correlator receiver used here %------------------------------------------------------------------For i=1:200:size(demodulated,2) Y= [y trapz(t(i:i+199), demodulated(i:i+199))]; End Received = y>0; Figure; Stem(received) Title(’Impilses of received bits’); Xlabel(’Time (Seconds) ->’); Ylabel(’Amplitude (Volts)’) Simulation Results: The output of the MATLAB code provides more insight into the modulation techniques. Apart from plotting the modulated and demodulated signal, it also shows the constellation at transmitter/receiver and the Power Spectral Density of the BPSK modulated signal. 89 QPSK MODULATION AND DEMODULATION Figure 3.8 3.4 Sampling and results. QPSK Modulation and Demodulation Quadrature Phase Shift Keying (QPSK)[5] is a sort of stage direction technique, in which two information bits (joined as one picture) are adjusted as soon as possible, picking one among the 4 carriers arrange move states. QPSK movement inside picture term Tsym values are given s(t) = Acos[2πf ct + θn ], 0 = t = Tsym , n = 1, 2, 3, 4 (3.11) where the signal phase is given by θn = (2n1) π 4 (3.12) 7π 4 radians. s(t) = Acosθn cos(2πfc t) − Asinθn sin(2πfc t) = sni φi (t) + snq φq (t) (3.13) Therefore, the four possible initial signal phases are Equation (3.11) can be rewritten as π 3π 5π 4, 4 , 4 and The enunciation shows usage of two orthonormal preface limits: (φi (t), (φq (t))(φi (t), (φq (t)) (3.14) The above expression indicates the use of two orthonormal basis functions: < φi (t), φq (t) > 90 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB together with the inphase and quadrature signaling points: < sni , snq > Therefore, on a two-dimensional coordinate system with the axes set to φi (t) and φq (t), the QPSK signal is represented by four constellation points dictated by the vectors < sni , snq > with n = 1, 2, 3, 4. 3.4.1 QPSK Transmitter The QPSK transmitter, shown in Figure 3.9, is executed as a MATLAB work qpsk mod. In this execution, a splitter segregates the odd and even bits from the created information bits. Each flood of different bits, as well as even bits, are changed over NRZ mastermind parallel. Figure 3.9 Waveform simulation model for QPSK modulation. CODE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 clc; clear all; bits = 1000000; data=randint(1,bits)>0.5; %---------------------debugging------------------------------------%data-[1 1 1] %------------------------------------------------------------------Ebno=0:10; BER=zeros(1,length(data)/2; I=zeros(1,col); Q=I; I=data(1:2:bits-1); Q=data(2:2:bits); I= -2.*I+1; QPSK MODULATION AND DEMODULATION 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 91 Q= -2.*Q+1; Symb=I+i.*Q; %--------Filter----------------------------------------------------Psf=ones(1,1); %------------------------------------------------------------------M=length(psf); For i=1:length(ebno) %------------------------------------------------------------------% inserting zeros between the bits w.r,t number of coefficients of % PSF to pass the bit stream from the PSF %------------------------------------------------------------------Z=zeros(M-1,bits/2); Upsamp=[symb;z]; Upsamp2=reshape(upsamp,1,(M)*bits/2); %------------------------------------------------------------------%passing the symbols from PSF %tx_symb=conv(real(upsamp2),psf)+j*Conv(imag(upsamp2,psf); %------------------------------------------------------------------Tx_symb=conv(upsamp2,psf); %----------------CHANNEL-------------------------------------------%Random noise generation and addition to the signal %------------------------------------------------------------------Npsd=10.ˆ(ebno(i)/10); n_var=1/sqrt(2.*npsd); rx_symb=tx_symb+(n_var*randn(1,length(tx_symb)) +j*n_var*randn(1,length(tx_symb))); %--------------------RECEIVER--------------------------------------rx_match=conv(rx_symb,psf); rx=rx_match(M:M:length(rx_match)); rx=rx(1:1:bits/2); recv_bits=zeros(1,bits); %------------------------------------------------------------------%demapping %------------------------------------------------------------------K=1; For ii=1:bits/2 recv_bits(k)= -(sign(real(rx(ii)))-1)/2; recv_bits(k+1)=-(sign(imag(rx(ii))) -1/2; k=k+2; end %sign(real(rx)) %sign(imag(rx)) %data %tx_symb %rx_symb %recv_bits %------------------------------------------------------------------%---SIMULATED BIT ERROR RATE---errors=find(xor(recv_bits,data)); errors=size(errors,2); BER(i)=errors/bits; 92 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB %------------------------------------------------------------------End Fs=1; N_pt=2ˆ9; Tx_spec=fft(tx_symb,n_pt); F= -fs/n_pt:fs/2-fs/n_pt; Figure Plot(f,abs(fftshift(tx_spec))); Title(signal Spectrum for signal with Rectangular Pulse Shaping for QPSK;); Xlabel(’Fequency [Hz]’); Ylabel(’x(F)’); Figure Semilogy(ebno,BER,’b.-’); Hold on; Thr=0.5*erfc(sqrt(10.ˆ(ebno/10))); Semilogy(ebno,thr,’rx-’); Xlabel(’Eb/No (dB)’ ); Ylabel(’Bit Error rate’); Title(’Simulated Vs Theoritical Bit Error Rate for QSPK’); Legend(’Simulation’,’Theory’); grid on; Figure 3.10 Timing diagram for BPSK and QPSK modulations. Figure 3.10 shows the diagrammatic representation for BPSK and QPSK. For BPSK, change picture range of each and every piece is similar to bit term. Anyway, for QPSK picture length is twice the bit length: Tsym = 2Tb Tsym = 2Tb (3.15) QPSK MODULATION AND DEMODULATION 93 Thusly, if the QPSK pictures were transmitted at a similar rate as BPSK, evidently QPSK transmits twice the data which BPSK transmits. In the wake of oversampling and heartbeat framing, it is normally apparent that the signal on the I-arm and Q-arm are BPSK signals with picture term 2Tb . The signal on the in-arrange arm is then copied by cos(2πfc t) and the signal on the quadrature arm is expanded by −sin(2πfc t). QPSK adjusted is obtained by including the signal from both in-stage and quadrature arms. 3.4.2 QPSK Receiver In light of its remarkable relationship with BPSK, the QPSK beneficiary acknowledges the slightest troublesome casing, as shown in Figure 3.11. In execution, I and Q channel signals were demodulated similarly in the BPSK demodulation. At the end of demodulation, I and Q channel progressions are stabilized together. The limit qpsk_demodimplements a QPSK demodulator, as indicated in Figure 3.11. Figure 3.11 3.4.3 Waveform simulation model for QPSK demodulation. Performance Simulation over AWGN The whole waveform generation for the already specified QPSK change and demodulation is given straight away. The signal incorporates, making discretionary message bits, altering them using QPSK adjust, the development of awgn channel multiplexed with the proposition movement and result in demodulating the disorderly signals using QPSK infuence. The waveforms at the distinctive periods of the modulator are shown in Figure 3.12. 94 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB Figure 3.12 Simulated QPSK waveforms at the transmitter side. The execution reenactment for the QPSK transmitter-authority blend was further coded in the code given above, and the resulting piece screw up rate execution curve will be the same as that of customary BPSK. 3.5 3.5.1 Image Error Rate vs Signal-to-Noise Ratio M-QAM Modulation In M-ASK change method the information pictures (each k = log2 (M ) bit wide) are encoded into the abundance of the sinusoidal conveyor. In M-PSK changing the data is encoded by the time of the sinusoidal carrier. M-QAM turns for dull control strategy where the information is encoded in both plentifulness as well as the time of sinusoidal transporter. It stabilizes M-ASK and M-PSK direction systems. M-QAM change method is a 2-D adjust framework which requires two orthonormal introduce limits [10]. The M-QAM regulated signals are 2 cos (2πfc t) 0 ≤ t ≤ Ts (3.16) φI (t) = Ts 2 cos (2πfc t) 0 ≤ t ≤ Ts (3.17) φQ (t) = Ts IMAGE ERROR RATE VS SIGNAL-TO-NOISE RATIO 95 The M-QAM modulated signal is represented as 2 cos (2πfc t) , 0 ≤ t ≤ Ts , i = 1..M Ts (3.18) Here, VI,I and VQ,I are the amplitudes of the quadrature bearers abundance balanced by the data images. Si (t) = VI,i 3.5.2 2 cos (2πfc t) + VQ,i Ts Baseband Rectangular M-QAM Modulator There exist other constellations that are more efficient (in terms of energy required to achieve same error probability) than the standard rectangular constellation. But due to its simplicity in modulation and demodulation, square constellations are preferred. In practice, the information symbols are gray coded in order to restrict the erroneous symbol decisions to single bit error; the adjacent symbols in the transmitter constellation should not differ more than one bit. Usually, the gray coded symbols are separated into in-phase and quadrature bits and then mapped to M-QAM constellation [10]. The rectangular configuration of QAM makes it easier to constellate the previously mentioned steps into a simplified Look-Up-Table (LUT) approach (Figure 3.13). Figure 3.13 M-QAM modulator. The values in the LUT (where the reference constellation is stored) are normalized by the normalization mentioned above factor, and then the 64-QAM signal is generated. The simulation model for M-QAM modulation is given in Figure 3.14. The receiver uses Euclidean distance as a metric to decide on the received symbols. 96 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB Figure 3.14 M-QAM simulation model. Matlab Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 %------------------------------------------------------------------% Demonstration of Eb/N0 Vs SER for M-QAM modulation scheme %------------------------------------------------------------------clear;clc; %---------Input Fields-----------------------%Number of input symbols N=10000; %Define EbN0dB range for simulation EbN0dB = -6:2:12; %for 16-QAM modulation. M=16; %------------------------------------------------------------------refArray =1/sqrt(10)*[-3-3j,-3-1j,-3+3j,-3+1j,-1-3j,-1-1j,-1+3j, -1+1j,3-3j,3-1j,3+3j,3+1j,1-3j,1-1j,1+3j,1+1j]; symErrSimulated = zeros(1,length(EbN0dB)); k=log2(M); EsN0dB = EbN0dB + 10*log10(k); %------------------------------------------------------------------%-Generating a uniformly distributed random numbers in the % set [0,1,2,..,M-1] %------------------------------------------------------------------data=ceil(M.*rand(N,1))-1; %16-QAM Constellation mapping with Gray coding s=refArray(data+1); %Reference Constellation for demodulation and Error rate computation refI = real(refArray); refQ = imag(refArray); %------------------------------------------------------------------%Place holder for Symbol Error values for each Es/N0 %for particular M value %------------------------------------------------------------------index=1; figure(1); subplot(1,2,1); plot(real(s),imag(s),’r*’); title(’Constellation diagram for Transmitted Symbols’); IMAGE ERROR RATE VS SIGNAL-TO-NOISE RATIO 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 97 xlabel(’Inphase component’); ylabel(’Quadrature component’); subplot(1,2,2); for x=EsN0dB, %-------Channel Noise for various Es/N0----------------------------%Adding noise with variance according to the required Es/N0 %Standard deviation for AWGN Noise %------------------------------------------------------------------noiseVariance = 1/(10.ˆ(x/10)); noiseSigma = sqrt(noiseVariance/2); %Creating a complex noise for adding with M-QAM modulated signal %Noise is complex since M-QAM is in complex representation noise = noiseSigma*(randn(size(s))+1i*randn(size(s))); received = s + noise; %------------------------------------------------------------------% I-Q Branching %------------------------------------------------------------------r_i = real(received); r_q = imag(received); %------------------------------------------------------------------%Decision Maker-Compute(r_i-s_i)ˆ2+(r_q-s_q)ˆ2 and % choose the smallest %------------------------------------------------------------------r_i_repmat = repmat(r_i,M,1); r_q_repmat = repmat(r_q,M,1); plot(r_i,r_q,’*’); title([’Constellation diagram for Received Symbols Eb/N0=’ num2str(x-10*log10(k)) ’dB’]); xlabel(’Inphase component’); ylabel(’Quadrature component’); pause; %place holder for distance metric distance = zeros(M,N); minDistIndex=zeros(N,1); for j=1:N %---Distance computation - (r_i-s_i)ˆ2+(r_q-s_q)ˆ2 -------------distance(:,j)=(r_i_repmat(:,j)-refI’).ˆ2 +(r_q_repmat(:,j)-refQ’).ˆ2; %Capture the index in the array where the minimum distance occurs [dummy,minDistIndex(j)]=min(distance(:,j)); end %The index becomes the decoded symbol y = minDistIndex - 1; %--------------Symbol Error Rate Calculation----------------------dataCap = y; symErrSimulated(1,index) = sum(dataCap˜=data)/N; index=index+1; end %----- Compute Theoretical Symbol Error Rates --------------------%EsN0lin = 10.ˆ(EsN0dB/10); EbN0lin = 10.ˆ(EbN0dB/10); symErrTheory = 2*(1-1/sqrt(M))*erfc(sqrt(3/2*k*EbN0lin/(M-1))); %------------------------------------------------------------------% Plotting commands %------------------------------------------------------------------- 98 95 96 97 98 99 100 101 102 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB figure(2); semilogy(EbN0dB,symErrTheory,’r-’); hold on; semilogy(EbN0dB,symErrSimulated,’b*’); legend(’16QAM-Theory’,’16QAM-Sim’); xlabel(’Eb/N0(dB)’); ylabel(’Symbol Error Rate (Ps)’); grid on; Simulation results: Figure 3.15 Samples of in-phase component. RECREATION OF OFDM FRAMEWORK 3.6 99 Recreation of OFDM Framework In modulations, information is mapped onto changes in frequency, phase or amplitude (or a combination of them) of a carrier signal. Multiplexing deals with allocation/accommodation of users in a given bandwidth (i.e., it deals with allocation of available resource). OFDM (Orthogonal frequency division multiplexing) is a combination of modulation and multiplexing. In this technique, the given resource (bandwidth) is shared among individual modulated data sources. Normal modulation techniques (like AM, PM, FM, BPSK, QPSK, etc.) are single carrier modulation techniques, in which the incoming information is modulated over a single carrier. OFDM is a multicarrier modulation technique, which employs several carriers, within the allocated bandwidth, to convey the information from source to destination. Each carrier may employ one of the several available digital modulation techniques (BPSK, QPSK, QAM, etc.) [8]. OFDM is very effective for communication over channels with frequency selective fading (different frequency components of the signal experience different fading). It is very difficult to handle frequency selective fading in the receiver, in which case, the design of the receiver is hugely complex. Instead of trying to mitigate frequency selective fading as a whole (which occurs when a huge bandwidth is allocated for the data transmission over a frequency selective fading channel), OFDM mitigates the problem by converting the entire frequency selective fading channel into small flat fading channels (as seen by the individual subcarriers). Flat fading is easier to combat (when compared to frequency selective fading) by employing simple error correction and equalization schemes [12]. To reenact an OFDM structure, the following arrangement parameters are crucial (Figure 3.16). Figure 3.16 An OFDM communication architecture with a cyclic prefix. 100 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB Consider that we want to send the following data bits using OFDM: D = {d0 , d1 , d2 , ...} (3.19) The first thing that should be considered in designing the OFDM transmitter is the number of subcarriers required to send the given data. As a generic case, let’s assume that we have N subcarriers. Each subcarrier is centered at frequencies that are orthogonal to each other (usually multiples of frequencies). The second design parameter could be the modulation format that we wish to use. An OFDM signal can be constructed using any of the following digital modulation techniques, namely BPSK, QPSK, QAM, etc. The data (D) has to be first converted from serial stream to parallel stream depending on the number of subcarriers (N). Since we assumed that there are N subcarriers allowed for the OFDM transmission, we name the subcarriers from 0 to N − 1. Now, the Serial to Parallel converter takes the serial stream of input bits and outputs N parallel streams (indexed from 0 to N − 1). These parallel streams are individually converted into the required digital modulation format (BPSK, QPSK, QAM, etc.). Let us call this output S0 , S1 , .., SN . The conversion of parallel data (D) into the digitally modulated data (S) is usually achieved by a constellation mapper, which is essentially a lookup table (LUT). Once the data bits are converted to required modulation format, they need to be superimposed on the required orthogonal subcarriers for transmission. This is achieved by a series of N parallel sinusoidal oscillators tuned to N orthogonal frequencies (f0 , f1 , .., fN −1 ). Finally, the resultant output from the parallel arms are summed up together to produce the OFDM signal. The following figure illustrates the basic concept of OFDM transmission (Note: In order to give a simple explanation to illustrate the underlying concept, the usual IFFT/FFT blocks that are used in actual OFDM system, are not used in the block diagram). Given parameters in the spec: 1 2 3 4 5 6 7 8 %FFT size or total number of subcarriers (used + unused) 64 N=64; %Number of data subcarriers 48 Nsd = 48; %Number of pilot subcarriers 4 Nsp = 4; % OFDM bandwidth ofdmBW = 20 * 10ˆ6 ; Derived parameters: 1 2 3 4 5 6 7 8 9 10 %Bandwidth for each subcarrier-include all used and unused subcarries deltaF = ofdmBW/N; % IFFT or FFT period = 3.2us Tfft = 1/deltaF; % Guard interval duration - duration of cyclic prefix % 1/4th portion of OFDM symbols Tgi = Tfft/4; RECREATION OF OFDM FRAMEWORK 11 12 13 14 15 16 17 18 19 20 21 101 % Total duration of BPSK-OFDM symbol = Guard time + FFT period Tsignal = Tgi+Tfft; %Number of symbols allocated to cyclic prefix Ncp = N*Tgi/Tfft; % Number of total used subcarriers Nst = Nsd + Nsp; %BPSK the number of Bits per Symbol is same as number of subcarriers nBitsPerSym=Nst; The direct for this circumstance is shown as a clear AWGN channel. It is an AWGN channel; prerequisite procedure is not present for the repeat region equalizer. Currently, we are working in the AWGN channels; here we removed the repeat space equalizer from the above layout. 3.6.1 Figuring (Es /N0 ) or (Eb /N0 ) for OFDM Framework Created 0 mean and unit variance disturbance must be scaled in a like manner to address (Eb /N0 ) or (Es /N0 ). So, both the Eb /N0 and Es /N0 were similar for BPSK. Regardless of OFDM BPSK structure, they differ. This is because every OFDM picture has extra overhead in time territory as well as repeat space. 3.6.2 Impact of Cyclic Prefix on Es /N Going with chart portrays the possibility of the cyclic prefix. Every OFDM picture has useful data as well as overhead. Here, bit imperativeness addresses essentialness enclosed with valuable bits. For example, bit essentialness which helps to spread over N bits. Over the helpful information, extra Ncp bits were incorporated as the cyclic prefix, which are those that are outlining the overhead. Figure 3.17 Effect of cyclic prefix on Es /N0 . 102 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB The relationship is shown as Es (N + Ncp ) = N Eb (3.20) which translates to the equation below. Es = 3.6.3 N × Eb N + Ncp (3.21) Effect of Unused Subcarriers on Es/N Since specified before, only some of the subcarriers are utilized for transmission. From the aggregate N subcarriers, just Nst transporters are being used for OFDM images transmission (they incorporate the two information and pilot subcarriers). Once more, in the recurrence area, the valuable piece vitality is spread crosswise over Nst subcarriers, though the image vitality is spread crosswise over N subcarriers. Es × N = Nst × Eb (3.22) which translate to the equation below Es = Nst × Eb N (3.23) In Equations (3.21) and (3.22), the overall effect of both cyclic prefix and unused subcarriers on Es /N0 is given by ES Nst Eb N = (3.24) N0 Ncp + N N N0 which, when converted to dB yields the following relationship: ES Nst Eb N dB + dB + dB = N0 Ncp + N N N0 db (3.25) Since Ncp cyclic prefix is added to the OFDM symbol, the output signal from the parallel to serial converter has to be boosted to compensate for the wastage of energy associated with the addition of a cyclic prefix. To correctly generate the required SNR in MATLAB, the signal term at the output of the parallel to serial converter has to be scaled as follows: Ncp + N Boosted OF DM signal = × OF DM signal (3.26) N The received signal is represented as (for the given Eb /N0 ). y = boosted OF DM signal + required noise (3.27) RECREATION OF OFDM FRAMEWORK 3.6.4 103 Arrangement of Subcarriers The IEEE 802.11 specification specifies how to arrange the given subcarriers. The 52 used subcarriers (data + pilot) are assigned numbers from −26, −25, .. − 2, −1 and 1, 2, .., 25, 26. The following figure illustrates the scheme of assigning these subcarriers to the IFFT inputs. Figure 3.18 3.6.5 Assignment of OFDM subcarriers. MATLAB Sample Code OFDM Transmitter part code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 clc; clear all; close all; %------------------------------------------------------------------% Initiation %------------------------------------------------------------------%Number of bits per channel extended to 128 no_of_data_bits = 64 %Number of subcarrier channel M =4 %Total number of bits to be transmitted at the transmitter n=256; %Size of each OFDM block to add cyclic prefix block_size = 16; %Length of the cyclic prefix cp_len = floor(0.1 * block_size); %------------------------------------------------------------------% Transmitter %------------------------------------------------------------------% Source generation and modulation %------------------------------------------------------------------- 104 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB % Generate random data source to be transmitted of length 64 data = randsrc(1, no_of_data_bits, 0:M-1); figure(1),stem(data); grid on; xlabel(’Data Points’); ylabel(’Amplitude’) title(’Original Data ’) %------------------------------------------------------------------% Perform QPSK modulation on the input source data %------------------------------------------------------------------qpsk_modulated_data = pskmod(data, M); figure(2),stem(qpsk_modulated_data); title(’QPSK Modulation ’) %------------------------------------------------------------------% Converting the series data stream into four parallel data stream % to form four sub carriers %------------------------------------------------------------------S2P = reshape(qpsk_modulated_data, no_of_data_bits/M,M) Sub_carrier1 = S2P(:,1) Sub_carrier2 = S2P(:,2) Sub_carrier3 = S2P(:,3) Sub_carrier4 = S2P(:,4) figure(3), subplot(4,1,1), stem(Sub_carrier1), title(’Subcarrier1’), grid on; subplot(4,1,2), stem(Sub_carrier2), title(’Subcarrier2’),grid on; subplot(4,1,3), stem(Sub_carrier3), title(’Subcarrier3’), grid on; subplot(4,1,4), stem(Sub_carrier4), title(’Subcarrier4’), grid on; %------------------------------------------------------------------% IFFT OF FOUR SUB_CARRIERS %------------------------------------------------------------------number_of_subcarriers=4; cp_start=block_size-cp_len; ifft_Subcarrier1 = ifft(Sub_carrier1) ifft_Subcarrier2 = ifft(Sub_carrier2) ifft_Subcarrier3 = ifft(Sub_carrier3) ifft_Subcarrier4 = ifft(Sub_carrier4) figure(4), subplot(4,1,1), plot(real(ifft_Subcarrier1),’r’), title(’IFFT on all the sub-carriers’) subplot(4,1,2), plot(real(ifft_Subcarrier2),’c’) RECREATION OF OFDM FRAMEWORK 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 105 subplot(4,1,3), plot(real(ifft_Subcarrier3),’b’) subplot(4,1,4), plot(real(ifft_Subcarrier4),’g’) %------------------------------------------------------------------% ADD-CYCLIC PREFIX %------------------------------------------------------------------for i=1:number_of_subcarriers, % 16 is the ifft point ifft_Subcarrier(:,i) = ifft((S2P(:,i)),16) for j=1:cp_len, cyclic_prefix(j,i) = ifft_Subcarrier(j+cp_start,i) end Append_prefix(:,i)=vertcat(cyclic_prefix(:,i),ifft_Subcarrier(:,i)) %------------------------------------------------------------------% Appends prefix to each subcarriers %------------------------------------------------------------------end A1=Append_prefix(:,1); A2=Append_prefix(:,2); A3=Append_prefix(:,3); A4=Append_prefix(:,4); figure(5), subplot(4,1,1), plot(real(A1),’r’), title(’Cyclic prefix added to all the sub-carriers’) subplot(4,1,2), plot(real(A2),’c’) subplot(4,1,3), plot(real(A3),’b’) subplot(4,1,4), plot(real(A4),’g’) figure(11), plot((real(A1)),’r’), title(’Orthogonality’), hold on, plot((real(A2)),’c’), hold on, plot((real(A3)),’b’), hold on, plot((real(A4)),’g’), hold on, grid on; %------------------------------------------------------------------%Convert to serial stream for transmission %------------------------------------------------------------------[rows_Append_prefix cols_Append_prefix]=size(Append_prefix) len_ofdm_data = rows_Append_prefix*cols_Append_prefix %------------------------------------------------------------------% OFDM signal to be transmitted 106 138 139 140 141 142 143 144 145 146 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB %------------------------------------------------------------------ofdm_signal = reshape(Append_prefix, 1, len_ofdm_data); figure(6), plot(real(ofdm_signal)); xlabel(’Time’); ylabel(’Amplitude’); title(’OFDM Signal’); grid on; %------------------------------------------------------------------- Passing time domain data through channel and AWGN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 %------------------------------------------------------------------channel = randn(1,2) + sqrt(-1)*randn(1,2); after_channel = filter(channel, 1, ofdm_signal); awgn_noise = awgn(zeros(1,length(after_channel)),0); %------------------------------------------------------------------% With AWGN noise %------------------------------------------------------------------recvd_signal = awgn_noise+after_channel; figure(7), plot(real(recvd_signal)),xlabel(’Time’); ylabel(’Amplitude’); title(’OFDM Signal after passing through channel’); grid on; %------------------------------------------------------------------- OFDM receiver part 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 %------------------------------------------------------------------recvd_signal_paralleled=reshape(recvd_signal,rows_Append_prefix, cols_Append_prefix); %------------------------------------------------------------------% Remove cyclic Prefix %------------------------------------------------------------------recvd_signal_paralleled(1:cp_len,:)=[]; R1=recvd_signal_paralleled(:,1); R2=recvd_signal_paralleled(:,2); R3=recvd_signal_paralleled(:,3); R4=recvd_signal_paralleled(:,4); figure(8),plot((imag(R1)),’r’), subplot(4,1,1),plot(real(R1),’r’), title(’Cyclic prefix removed from the four sub-carriers’) subplot(4,1,2),plot(real(R2),’c’) subplot(4,1,3),plot(real(R3),’b’) subplot(4,1,4),plot(real(R4),’g’) %------------------------------------------------------------------% FFT Of recievied signal %------------------------------------------------------------------for i=1:number_of_subcarriers, % FFT fft_data(:,i) = fft(recvd_signal_paralleled(:,i),16); end F1=fft_data(:,1); RECREATION OF OFDM FRAMEWORK 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 107 F2=fft_data(:,2); F3=fft_data(:,3); F4=fft_data(:,4); figure(9), subplot(4,1,1), plot(real(F1),’r’), title(’FFT of all the four sub-carriers’) subplot(4,1,2), plot(real(F2),’c’) subplot(4,1,3), plot(real(F3),’b’) subplot(4,1,4), plot(real(F4),’g’) %------------------------------------------------------------------% Signal Reconstructed %------------------------------------------------------------------% Conversion to serial and demodulationa %------------------------------------------------------------------recvd_serial_data = reshape(fft_data, 1,(16*4)); qpsk_demodulated_data = pskdemod(recvd_serial_data,4); figure(10) stem(data) hold on stem(qpsk_demodulated_data,’rx’); grid on; xlabel(’Data Points’); ylabel(’Amplitude’); title(’Recieved Signal with error’) Simulated Result: From the simulated result, it can be ascertained that the OFDMBPSK modulation has no advantage over a normal BPSK system in AWGN. OFDM proves to be effective in multipath environments. Figure 3.19 Eb /N0 Vs BER for BPSK-OFDM over AWGN. 108 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB OFDM Basic Tx-Rx Chain Figure 3.20 OFDM essential Tx-Rx chain. The OFDM MATLAB code for the block schematic in Figure 3.20 is provided below for download. OFDM transmitter in this example consists of FEC encoder, BPSK modulator, and 256-point IFFT. OFDM receiver part consists of FFT, BPSK demodulator and Viterbi decoder. BER curve for this OFDM MATLAB model is mentioned below taken after passing the transmitter data from AWGN channel. Figure 3.21 3.7 BER results. Conclusion This chapter introduced digital communication using network modeling and how to create a model with the software which is not vulnerable and can be accessible all over the globe for the communications. Described in this chapter were data transmission mechanisms, how to create a secure channel, and how to modify data for CONCLUSION 109 the sake of security. Methods of communicating with the secure channel is one of the things students will find of interest in this chapter. This chapter also dealt with different simulation models explained with basic sample codes, all of which are executable and error free. Students can practice the codes in the terminal and learn new things from the book. QPSK demodulation theory has been explained well in the chapter, which also contains other interesting topics like recreation frameworks and the importance of recreation and the other frameworks which are used for better communication and also for better secured channel creation and implementation. REFERENCES 1. IEEE 802.11 specification - Orthogonal frequency division multiplexing (OFDM) PHY specification for the 5 GHz band- chapter 17, Wireless Communication Systems in MATLAB, ISBN: 978-1720114352 2. Lloyd N. Trefethen, David Bau III, Numerical linear algebra, Philadelphia: Society for Industrial and Applied Mathematics, ISBN 978-0-89871-361-9, pp.56 3. Feng, J. (2007). Digital Communications and Signal Processing with MATLAB Examples. Lecture Notes. The University of Warwick. 4. Etemadi, F., Heydari, P.,& Jafarkhani, H. (2018). On Analog QAM Demodulation for Millimeter-Wave Communications. IEEE Transactions on Circuits and Systems II: Express Briefs. 5. Munjal, S., Lathwal, H., Kumar, R., & Verma, V. (2018). COMPARATIVE ANALYSIS OF BPSK, QPSK, QAM MODULATION, AND DEMODULATION TECHNIQUE WITH BIT ERROR RATE USING MATLAB 2014A. Journal of Advances in Computational Intelligence and Communication Technologies, 2(1), 46-48. 6. Upase, S. J., & Labade, R. P. (2018, February). Design and Implementation of Encrypted SDR and Study of Noise in High-Level System Architecture Using MATLAB. In 2018 International Conference on Advances in Communication and Computing Technology (ICACCT) (pp. 197-202). IEEE. 7. Razali, S. (1999). Digital communication system simulation using matlab (Doctoral dissertation, Universiti Teknologi Malaysia). 8. Viswanathan, M. (2013). Simulation of digital communication systems using Matlab. Mathuranathan Viswanathan at Smashwords. 9. Silage, D. (2009). Digital Communication Systems Using MATLAB and Simulink. Bookstand Pub. 10. Patel, J. N., & Dalal, U. D. (2007, December). A comparative performance analysis of OFDM using MATLAB simulation with M-PSK and M-QAM mapping. In Conference on Computational Intelligence and Multimedia Applications, 2007. International Conference on (Vol. 4, pp. 406-410). IEEE. 11. Ghassemlooy, Z., Popoola, W., & Rajbhandari, S. (2012). Optical wireless communications: system and channel modeling with Matlab. CRC press. 12. Cho, Y. S., Kim, J., Yang, W. Y., & Kang, C. G. (2010). MIMO-OFDM wireless communications with MATLAB. John Wiley & Sons. 110 DIGITAL COMMUNICATION SYSTEM SIMULATION USING MATLAB 13. Ingle, V. K., & Proakis, J. G. (2016). Digital Signal Processing Using MATLAB: A Problem Solving Companion. Cengage Learning. 14. Blanchet, G., & Charbit, M. (2006). Digital signal and image processing using MATLAB (Vol. 4). London: Iste. 15. Milic, L. (Ed.). (2009). Multirate Filtering for Digital Signal Processing: MATLAB Applications: MATLAB Applications. IGI Global. CHAPTER 4 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Abstract In this chapter, we explain how to perform statistical analysis of network data utilizing MATLAB starting from affiliation systems/networks with examples. We also explain time series analysis, statistical stationarity, time series decomposition, de-trending, curve fitting, digital filtering, recurrence reaction, and connection between recurrence reaction to spline parameter. Next we have provide details about autocorrelation, test for independence, linear autoregressive models, etc. Keywords: Statistical analysis, association network Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 111 112 4.1 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Introduction to Association Networks We can utilize ARN as an orderly apparatus to include choice [1-2]. The means included are: 1. Setting up the information for affiliation governs mining. This involves changing the data into exchanges where every exchange is an itemset. Information, where factors are, should be discredited. 2. Note that ARNs are target driven so those association rules which are of interest are those that in a particular or roundabout way are related to the objective hub. An affiliation control calculation can be altered to produce just the essential principles. In any case, since our goal is to show the standard (as opposed to the particular case), higher estimations of the edge may be more reasonable. Figure 4.1 Flowchart of association rules implementation. 3. Fabricate the association rule network. This development has two or three exceptional cases which should be managed adequately. We may likewise pick the best k rules (by sureness) for the given target focus point. The high position here is that we don’t need to demonstrate the affirmation (or here and there even the help). In any case, now we need to choose the “best k.” Another favored edge is that, for the most part, we can comparatively utilize the “best k” way to deal with oversight to discover leads in higher proportions to the ARN [3, 4]. 4. Apply a gathering-together depending on the ARN to evacuate the immense highlights (as for the physical space). On a fundamental level, ARN is a sortedout hypergraph. We can utilize a hypergraph gathering include as addressed [5]. INTRODUCTION TO ASSOCIATION NETWORKS 113 Figure 4.2 (a) ARN for contact lens data with target node as hard; (b) ARN for contact lens data with target node as soft. 5. The segments of the packets are a social affair of things (features) which are connected. Pick one part of the gathering as the contender incorporate. The number of conventions picked is a parameter and will require specific alteration. 6. Fabricate and test a quantifiable model (e.g., backslide) to formally test the association between the ward and the contender factors. ARN Examples For the contact lens example, we utilize all things considered essential, instructive record from the UCI chronicle [1-2] to show how ARNs can be used for a fuse choice. The ARN for the lens information is shown in Figure 4.3. Figure 4.3 with ARN. Schematic diagram showing the activity method of communication in a software 114 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Poor people variable is whether a patient ought to be fitted with hard contact focal centers, delicate contact focal concentrations or ought not to be equipped with contact focal core interests. There are four attributes. We fabricated an ARN where the objective quality is the class. Support and confirmation were picked as zero. Plainly, both ARNs (for hard and delicate focal centers) can be utilized to awaken highlights. We have finished a broad examination of the Open Source Software space utilizing ARN. Motivations behind interest can be gotten from [3, 6]. The OSS information was gotten to comprehend why certain things open from sourceforge .net wind up standard. This is a cross-sectional examination. Maybe a future issue is to utilize ARNs for examination of longitudinal information. 4.2 4.2.1 Time Series, Stationary, Time Series Decomposition, De-trending Time Series Analysis In different applications, for example, physiology and performance, sweeping time course of action information bases are to be broken down, requiring the estimation of quick, nonlinear and unmistakable measures. Such measures have been made and acknowledged in business and freeware virtual things or conceived especially and energetically. The Measures of Analysis of Time Series (MATS) MATLAB device stash is relied upon to deal with a discretionary colossal strategy of scalar time course of action and enlists an enormous game plan of measures on them, also pondering the specification of changing measure parameters. The gathering of choices with included working environments for depiction of the results bolster different settings of time game plan examination; for example, the zone of segments changes in long information records, reinvestigating (surrogate or bootstrap) tests for independence in addition to linearity with different test bits of learning, and segment intensity of different measures in like manner, for different mixes of their parameters. The essential highlights of MATS are demonstrated in like manner, and the executed measures are briefly portrayed. The settlement of MATS is spread out on some right cases near the screen gets [7, 18, 22, 23]. Many made programming things join standard frameworks for time game plan examination. Business quantifiable packs, such as SPSS [8] and SAS Institute Inc. [9], have working environments on time blueprint which are extremely fundamental level executions of the standard Box-Jenkins approach on non-stationary time game plan. The business computational conditions of MATLAB (The MathWorks, Inc.) and SPLUS (Insightful Corp.) give distinctive gadget hold or modules that strategize with time course of action (MATLAB: Financial, Econometrics, Signal Handling, Neural Network and Wavelets; S-PLUS: FinMetrics, Wavelet, Environmental Details). Not so much standard, but rather more developed mechanical congregations of time game plan examination can be found in different business remain single programming bunches made for more specific employments of time course of action, and in two or three freeware packages, by and large gathering a game plan of ventures TIME SERIES, STATIONARY, TIME SERIES DECOMPOSITION, DE-TRENDING 115 instead of a fused programming, for instance, the TISEAN package which constellates an entire game plan of procedures for the dynamical structure approach [10]. In some open-source MATLAB apparatus stash other chosen methods for dismembering a data time plan, for instance, the time course of action examination toolbox TSA [11]. In various applications, particularly when the structure is to some degree astounding, as in seismology, air, performance and physiology, the change of models from data can be a noteworthy task. There the intrigue is somewhat in compact data from a period approach to some emptied highlights or measures that can be as immediate as illuminating bits of information or as convoluted as the dependability of _t of a nonlinear model including many free parameters. Besides, the present issue may join diverse time game plan, e.g., different stock records or constant territories from the split of a long physiological pennant such as an electrocardiogram (ECG) or electroencephalogram (EEG). The errand of dealing with these issues is to delineate, detach or amass the time game plan in light of the assessed measures. The Measures of Analysis of Time Series toolbox MATS is made in MATLAB to meet the as of now said needs. The reason behind MATS isn’t just to finish unquestionably appreciated and all-around endeavored measures, but to present in the same way different measures, which have been beginning to appear late in the synthesis and might be helpful in getting properties of the time approach. Moreover, MATS give several sorts of pre-arranging of discretionary long game plans of scalar time course of action. MATS mishandle the graphical UI (GUI) of MATLAB to build up an easy to use condition and depiction of working environments. In the figuring of two or three procedures, works in the Signal Processing, System Identification and Statistics MATLAB instrument stash are called upon. Measures identified with specific instrument stash, for example, GARCH models [12], neural structures and wavelets, are not understood in MATS. To stimulate estimations while sifting for neighboring focuses, MATS utilizes k-D tree information structure worked in outside _les (.dll for Windows and .mexglx for Linux), which are kept up by MATLAB modifications 6.5 or later. 4.2.2 Stationarity Statistical Stationarity: A stationary time course of action is one whose verifiable properties, for instance, mean, change, autocorrelation, et cetera, are all in all relentless after some time. Most truthful checking methods rely upon the assumption that the time plan can be rendered around stationary (i.e., “stationarized”) utilizing logical changes. A stationarized game plan is respectably easy to predict: you fundamentally envision that its quantifiable properties will be the same later on as they have previously been! The figures for the stationarized plan would then have the capacity to be “untransformed,” by exchanging whatever logical changes were used in advance to secure the principal course of action desired. (The straightforward components are normally managed by your item.) Thus, finding the gathering of changes anticipated that would stationarize a period game plan as often as possible 116 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB gives fundamental bits of knowledge in the sweep for a reasonable deciding model. Stationarizing a period plan through differencing (where required) is a basic bit of the route toward fitting an ARIMA illustrate, as discussed in the ARIMA pages of these notes. Most business and budgetary time courses of action are far from stationary when conveyed in their remarkable units of estimation, and even subsequent to discharging or normal change they will usually still show designs, cycles, self-assertive walking, and other non-stationary direct. In case the course of action has a stable long-run design and tends to come back to the example line following an exacerbation, it may be possible to stationarize it by de-floating (e.g., by fitting an example line and subtracting it out before fitting a model, or else by including the time record as a free factor in a backslide or ARIMA illustrate), perhaps related to logging or crumbling. Such a plan is said to be slant stationary. In any case, now and again even deinclining isn’t satisfactory to make the course of action stationary, in which case it may be imperative to transform it into a movement of period-to-period or possibly season-to-season contrasts. If the mean, change, and autocorrelations of the primary game plan are not reliable in time, even in the wake of de-slanting, perhaps the estimations of the modifications in the course of action between periods or between seasons will be enduring. Such a course of action is said to be refinement stationary. (From time to time it might be hard to separate between a course of action that is floating stationary and one that is differentiating stationary and an assumed unit root test may be used to locate a more entire arrangement. We will return to this topic later in the chapter.) Figure 4.4 Time series plot for adjusted AUTOSALE/CPI. The fundamental difference of a period game plan is the course of action of changes beginning with one period then onto the following. If Yt implies the estimation of the time game plan Y at period t, by then the vital qualification of Y at period t is proportionate to Yt − Yt−1 . In State illustrations, the important refinement of Y is imparted as DIF F (Y ), and in Regress it is Y DIF F 1. If the primary refinement of Y is stationary and moreover absolutely sporadic (not autoconnected), by then Y is depicted by a subjective walk appear: each regard is an unpredictable TIME SERIES, STATIONARY, TIME SERIES DECOMPOSITION, DE-TRENDING 117 progress a long way from the past regard. In case the foremost differentiation of Y is stationary yet not absolutely unpredictable – i.e., if its impetus at period t is auto corresponded with its motivating force at earlier periods – then a further developed deciding model, for instance, exponential smoothing or ARIMA may be legitimate. (Note: if DIF F (Y ) is stationary and self-assertive, this exhibits a sporadic walk indicate appropriate for the primary course of action Y, not that a discretionary walk show should be fitted to DIF F (Y ). Fitting a subjective walk model to Y is sensibly indistinguishable to fitting a mean (reliable simply) model to DIF F (Y ).) Figure 4.5 4.2.3 Time series chart with obtained output form. Time Series Decomposition Time arrangement deterioration includes isolating a period arrangement into a few unmistakable segments. There are three segments that are normally intriguing: Tt , a deterministic, non-seasonal mainstream drift segment. This segment is in some cases confined to being a direct pattern; however, higher-degree polynomials are additionally utilized. St is a deterministic occasional segment with known periodicity. This part catches level moves that rehash deliberately inside a similar period (e.g., month or quarter) between progressive years. Usually thought to be a disturbance part, occasional alteration is a procedure for disposing of it. It , a stochastic unpredictable segment. This part isn’t really a repetitive sound. It can display autocorrelation and cycles of flighty span. Hence, it is usually contemplated in the business cycle, and is typically the most intriguing part. There are three utilitarian structures that are regularly utilized for speaking to a period arrangement yt as an element of its pattern, occasional, and sporadic parts. 118 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Additive disintegration, where this is the established deterioration. It is fitting when there is no exponential development in the arrangement, and the adequacy of the occasional part stays consistent after some time. For identification from the pattern part, the regular and unpredictable segments are expected to vary around zero. Multiplicative disintegration, where this disintegration is suitable when there is exponential development in the arrangement, and the sufficiency of the regular part develops with the level of the arrangement. For identification from the pattern segment, the regular and unpredictable parts are accepted to change around one. Log-added substance decay, where this is a contrasting option to the multiplicative decay. On the off chance that the first arrangement has a multiplicative disintegration, at that point substance deterioration has been added to the logged arrangement. The logs can be best utilized when the time arrangement contains numerous little perceptions. For identification from the pattern part, the regular and unpredictable segments are accepted to vacillate around zero. You can appraise the pattern and regular parts by utilizing channels (moving midpoints) or parametric relapse models. Given assessments Tt and St , the sporadic segment is evaluated as utilizing the added substance decay, and utilizing the multiplicative decay. The arrangement (or on the other hand Tytt utilizing the multiplicative decay) is known as a de-trended arrangement. Thus, the arrangement yt −St (or Sytt ) is known as a de-seasonalized arrangement. 4.2.4 De-trending Model in a period approach is an immediate, interminable change in some property of the strategy over the entire between times under scrutiny. Model is once in a while incorrectly depicted all in all arrangement change in the mean, at any rate it can comparatively hint change in other quantifiable properties. For example, treering topology of overviewed ring width which has a point of reference in instability. In normal time strategy examination, a period course of action was separated into model, standard or irregular segments, and sporadic changes, and the differing parts were contemplated self-governing. Every once in a while current examination strategies treat the strategy without such routine disintegrating; in any case, isolate thought of model is still reliably required. De-slanting is the quantifiable or numerical activity of expelling plan from the game plan. De-inclining is consistently connected with expel a part thought to turn or cloud the relationship of intrigue. In climatology, for instance, a temperature incline from the perspective of urban warming may darken a relationship between shadiness and air temperature. De-floating is once in a while utilized as a preprocessing advancement to configuration time approach for examination by frameworks that expect stationarity. Different elective strategies are accessible for de-inclining. Clear quick precedent in mean can be expelled by subtracting a base squares-fit straight line. More puzzled models may require varying methods. TIME SERIES, STATIONARY, TIME SERIES DECOMPOSITION, DE-TRENDING 119 For instance, the cubic smoothing spline is generally utilized in dendrochronology to fit and evacuate ring-width slant, which most likely won’t be prompt or not even monotonically broadening or diminishing after some time. In contemplating and removing outline, it is essential to get a handle on the impact of de-inclining on the specter properties of the time strategy. This impact can be constellated by the rehash reaction of the de-floating point of confinement. 4.2.4.1 Recognizing Design: A Repeat Space Approach ID of point of reference in a period technique is energetic in light of the way that model in an outline can be observed from low repeat risks. What looks like propensity out of a minimal time range strategy piece dependably winds up being a low-repeat change – maybe part of a cycle – in the more drawn out approach. From time to time, learning the physical framework helps in seeing the plan. For instance, an abatement of ring width of a tree with time is regularly inadequate on geometrical grounds: the yearly development of wood is being set down on a dependably developing farthest point. On the off chance that the extent of wood made every year levels off as the tree ages, the ring width would be required to decay. The “changed negative exponential” de-inclining bend for ring width is kept up by this information of the physical framework. Without a physical clarification behind a particular model, we have to depend upon true systems. Granger and Hatanaka give some data on poor clarification of model [13]. They find that we can’t separate between a true blue plan and a low rehash change, and give the running with guide: It has been discovered helpful by the creator to consider as “coast” for a situation of size n all frequencies under 1 (2) n, as these will all be monotonic developing if the stage is zero, yet it must be underlined this is a discretionary run the show. It might additionally be seen that it is difficult to test whether a game plan is stationary or not, given just a limited case, as any undeniable model in mean could ascend out of an extraordinarily low rehash. On the off chance that we apply the above thinking to a 500-year tree-ring plan, we would express that collection with period longer than twofold the representation size, or 1000 years, ought to be viewed as model. Another paper portrays “incline in suggest” as containing all rehash parts whose wavelength beats the length of the watched time game plan [13]. Cook et al. [14] propose “skim in infer” thought in giving proposals for de-slanting tree-ring information: Given the above significance of model in mean, another target measure for picking the ideal rehash reaction of an electronic filer is as per the going with. Select a half rehash reaction cutoff in years for the channel that partners some critical level of the strategy length, n. This is the %n control delineated in Shumway and Woollacott [15]. The results of [15] prescribe that the rate is 67% to 75% in light of utilizing the cubic smoothing spline as a moved channel. The %n preface guarantees that little lowrehash differentiate, which is resolvable in the sorted-out tree rings, will be lost in assessing and clearing the change slant. This model also has a tendency of sorts on account of the firm character of the low-pass channel assessments of the progression incline. It won’t offer all around affirmation and, really, will vary from time to time while having any kind of perfect reliability of fit. 120 4.2.4.2 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Fitting the Pattern Four elective approaches to manage de-drifting are: 1. First differencing; 2. Twist fitting; 3. Mechanized filtering; 4. Piecewise polynomials. This portion is weighted seriously toward the piecewise polynomials approach, which is by and large used in dendrochronology. 4.2.4.3 First Differencing A period plan that is non-stationary in mean (e.g., slant in the way) can be affected static method by taking the model to isolate. The control separate is the processing of the estimation of the procedure now and again t and t − 1: wt = xt − xt−1 (4.1) where xt is the original time series and wt is the first-differenced series. If the series is nonstationarity in not just the mean but in the rate of change of the mean (the slope), stationarity can be induced by taking the second difference, or the first difference of the first difference: ut = wt − wt−1 (4.2) Differencing has been applied in hydrology in the context of ARIMA (Autoregressive integrated moving average) modeling of streamflow series [16]. Salas reports that first differencing can be risky in hydrology since it tends to bring a false high-rehash combination into an arrangement. Anderson portrays differencing as an approach to managing removal of non-stationarity from time game plan with everything considered. As shown by Anderson, each powerful differencing will reduce the instability of the blueprint, yet at some point, higher-engineer differencing will affect advancement in change. Right when instability develops, the approach has been over-differenced. First differencing is unsatisfactory for time strategy whose level itself has importance, as the differenced game plan is basically simply a change in level start with one insight then onto the accompanying, paying little respect to the level itself. 4.2.4.4 Curve Fitting If a period plan dynamically changes in level after some time, it looks good for consideration as an example for some direct limit of time itself. Sometimes the numerical sort of the example work has a stable start. For instance, a changed unfavorable exponential wind with a sensible beginning in the refinement in tree geometry with time has been utilized to discharge the “age trend” from ring-width strategy [19]. TIME SERIES, STATIONARY, TIME SERIES DECOMPOSITION, DE-TRENDING 121 All things considered, the most considered utilized breaking point of time used in de-slanting is the base squares-fit straight line, which treats arrange model. Simple linear regression is used to fit the model xt = a + bt + et (4.3) where xt is the critical experience strategy at time t, a is the regression constant, b is the regression constant, and et are the regression residuals. The trend is then described by gt = a + bt (4.4) where gt is the trend, a is the estimated regression constant, and b is the estimated regression coefficient. The advantage of the straight-line method is simplicity. The straight line may be unrealistic, however, in restricting the functional form of the trend. Other functions of t (e.g., quadratic) might be better depending on the type of data. 4.2.4.5 Digital Filtering Another procedure for dealing with trend is to describe the trend as a linearly filtered version of the original series. The original series is converted to a smooth “trend line” by weighting the individual observations gt = s at x(t+r) (4.5) r=−q where xt is the original series, {ar } is a set of filter weights (summing to 1.0), and gt is the smooth trend line. The weights are from time to time symmetric, with s = q and aj = a−j . If the weights are symmetric and all equal, the filter is a simple moving average, which generally is not recommended for measuring trend [20-21]. 4.2.4.6 Piecewise Polynomials An alternative to fitting a curve to the entire time series (curve fitting) is to fit polynomials of time to different parts of the time series. Polynomials used this way are called piecewise polynomials. The cubic smoothing spline is a piecewise polynomial of time, t, with the running with properties: The polynomial is cubic (t raised to the third power). A substitute polynomial is fit to each social affair of three fixations throughout the activity. The first and second helpers are constant at each point. The “spline parameter” chooses the adaptability and relies on the relative massiveness given to “smoothness” of the fitted bend, and “closeness of fit,” or how shut the fitted wind goes to the individual server farms. 122 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Given the approximate values yi = g(xi ) + i of some supposedly smooth function g at data points x1 , .., xn and a measure δyi of the standard deviation of yi , the issue is to recoup as far as possible from the information. Let s(xi ) be the spline curve, or the approximation to the smooth function g. Following De Boor [20], the spline curve is derived by minimizing the quantity p N yi − s(xi ) i=1 δyi + (1 − p) xN D2 s 2 (4.6) x1 Overall limits for a given spline parameter p, is that the place D2 s recommends the second subordinate of s concerning time. The first term is similar to a sum-ofsquares of deviations. The second term encourages cadenced development duties (second helper). Minimizing Equation (4.6) establishes a compromise between staying close to the given data (first term) and obtaining the smoothest possible curve (second term). The decision of p, where p can connect from 0 to 1, depends upon those two targets being given the more crucial centrality. For p = 0, s is the base squares straight-line fit to the information. At the other sensational, p = 1, s is the cubic spline interpolate, and encounters every datum point. As p ranges from 0 to 1, the smoothing spline changes beginning with one outstanding then onto the following. The term δyi considers the differential weighting of server farms. Following recommendations of De Boor et al. [20], we utilize the default MATLAB weighting (1 for all center interests). 4.2.4.7 Frequency Response The frequency response function describes how a linear system responds to sinusoidal inputs different frequencies [20-21]. The frequency response function has two components – the gain and the phase. The gain at a given frequency describes how the amplitude of a sinusoid at that frequency is damped or amplified by the system. The phase describes how a wave at that frequency is shifted in absolute time. In reference to a spline curve, the phase is zero, and the “frequency response” merely describes the gain, or the amplitude, of the response function. The input to the “system” in this case is the original time series; the output is the smoothed curve purported to represent the trend. The frequency response measures how strongly the spline curve would respond to or track a periodic component of a given frequency, should the time series have such a component. The amplitude of frequency response at a given frequency is the ratio of the amplitude of the sinusoidal component in the smoothed series (the spline curve) to the amplitude in the original time series. 4.2.4.8 Connection of Recurrence Reaction to Spline Parameter The cubic smoothing spline has wound up being legitimately remarkable as a deinclining system in dendrochronology in light of the way that the spline is adaptable and reasonably connected with an expansive collection of sorts of “age trend” or “growth trend” found in tree-ring information. Utilization of the spline to dendrochronology was first proposed by Cook and Peters [1], who derived a numerical TIME SERIES, STATIONARY, TIME SERIES DECOMPOSITION, DE-TRENDING 123 relationship between the rehash reaction of the spline and the spline parameter, p. The relationship is given by u(f ) = 1 − 1 1+ p(cos2πf +2) 6(cos2πf −1)2 (4.7) where u(f ) is the amplitude of frequency response at frequency f, and p is the spline parameter as defined earlier. A plot of u(f ) against f shows the response of the spline to variations at different frequencies. For trend lines, such as the smoothing spline, this response is higher toward the low-frequency end of the spectrum. Cook and Peters [1] moreover chose a unique relationship for the spline parameter p as a function of the “50% frequency response,” the frequency at which the amplitude of the frequency response of the spline is 0.50. This relationship is given by: 6(cos2πf − 1)2 p= (4.8) cos2πf + 2 Given a desired 50% frequency response, you can use Equation (4.8) to compute the spline parameter. For example, say the desired 50% frequency response is at a period 100 years, corresponding to a frequency of 1/100. The desired spline parameter is p= 6(0.998 − 1)2 = 7.7927E −6 0.998 + 2 (4.9) Call the MATLAB limits casps() with above spline parameter with respect to a given time plan, and it will yield the pertinently smoothed time game plan. 4.2.4.9 Evacuation of Pattern Once a model line has been fit to the information, we can see that line as tending to the “precedent.” The ask for remains, how to clear the model? On the off chance that the model perceiving check strategy has seen a precedent line, two choices are open. First is to subtract the estimation of the model line from the vital information, giving a period game plan of residuals from the precedent. This “capability” choice is beguiling for its straightforwardness, and for giving a strong breakdown of the change: the new blueprint is in obscure units from the fundamental approach, and the aggregate total of squares of the important information can be conferred as the model total of squares despite the remaining total of squares. The “degree” elective is connecting with two or three sorts of information in light of how the degree is dimensionless, and the degree task tends to expel glide in change that may keep running with a slant in the mean. Tree-ring width is one such information make: refinement of ring width has a tendency to be high when the mean ring width is high, and low when the mean ring width is low. Degree de-inclining, for the most part, is only possible for nonnegative time strategy, and perils the effect of the de-slanted course of action to high qualities if the fitted precedent line approaches near zero. De-inclining has an unclear impact on the range from high-pass separating, in that the change at low frequencies is reduced concerning fluctuation at high rates. 124 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB The rehash reaction of the spline is high for those frequencies act like spline. In the subsequent clearing of the precedent line, these frequencies are for the most part removed. Rates at which the rehash reaction of the spline is high are like those at which the extent of the de-slanted arrangement is low. Exactly when all is said and done, and there are no more lessened frequencies, the size of the de-slanted course of action will be reduced concerning the size of the primary information. The more flexible spline, the higher the rehash will be affected by the de-inclining standardized range. In looking at strategy de-inclined by various systems, it is positive to plot the ambiguous of two or three de-floated game plans on a relative match of tomahawks. To help the perception of the relative impacts of de-floating on various wavelengths, the spectra are best plotted as an organized range for such examination. Review that the domain in which the area lies with respect to the change occur. The space under the organized range is equivalent to one. Along these lines, the dispersing of advancement with rehash for a strategy with differences can be promptly separated and organized spectra plotted on a practically identical figure. 4.2.4.10 Measuring the Significance of Pattern A reasonable degree of the vital importance of precedent in a period strategy is the bit of exceptional contrast in the arrangement addressed by the fitted model line, which can be figured by var(et ) R2 = 1 − (4.10) var(xt ) where var(xt ) is the distinction in the foremost experience game plan, and var(et ) is the difference in the residuals from the model line. Equation (4.10) measures the centrality of the trend segment in a period strategy time game plan and can go from 0 for no criticalness to 1 if the course of action is an unadulterated precedent. 4.3 4.3.1 Autocorrelation, Test for Independence, Linear Autoregressive Models Autocorrelation This section depicts a MATLAB program with a Graphical UI (GUI) to figure the parameters of the autocorrelation and the intraoral cross-relationship parts of binaural pennant in context of the sound-related identity demonstrate proposed by Ando and Raichel, which can outline the differing hypothetical attributes such as pitch, timbre, and the spatial impression. The autocorrelation work (ACF) [17, 49] has been used to delineate the essential qualities of talk and music hails and has been associated with favored sound field conditions to getting together corridors. Primarily, the envelope delay of the ACF is used to depict the favored necessary time concede opening the resounding time because the favored condition of room acoustics immovably depends upon the transient properties of the source signal. Also, the fine structures of the ACF, for instance, the defer time, and the plentifulness of the ACF peaks, have been used to depict the pitch AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS 125 and timbre observations [5, 6]. The intraoral cross-relationship work (IACF) of the sound field has been used to portray the unique spatial characteristics of soundtracks. Moreover, these ACF and IACF parameters have been used to depict normal uproars and the sound quality in light of the way that the multidimensional assessment of the signal ascribes interfaces with the distinctive theoretical attributes such as sound tendency, tumult, load, talk intelligibility and so forth. The data binaural indications of a WAVE configuration report are experienced in an A-weighting framework. By then the ACF and IACF are figured by a FFT method according to Wiener-Khinchin theory.1 These calculation parameters can be varied through the substance modify fields in the GUI window (Figure 4.6). Waveforms of the ACF and IACF at each running development and the passing assortments of the ACF and IACF parameters are shown in the GUI window to check the settings figured. The table of the settings can be conveyed as the surpass desires mastermind. Figure 4.6 Output of wave configeration. Figure 4.6 shows the Graphical UI of the program. On the left - Top to bottom: The characters for best to base, for example, waveform, running ACF parameters, running IACF parameters, and a slider bar which demonstrates the results of each running development. On the right -Top to bottom: Filename and testing repeat, table of the parameters at each running packaging, ACF (left, y-rotate is in the logarithmic scale) 1 https://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin theorem 126 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB and IACF (right) waveform, starting setting parameters (joining between time, running development, most extraordinary slack, and the range to choose τ1 ), and the catches for “Load record,” “Figure,” and “Spare components.” 4.3.2 ACF and IACF Parameters τ1 and ϕ1 : The concede time and the adequacy of the chief critical apex of the institutionalized ACF, relating to the pitch wisdom. The essential huge zenith of the institutionalized ACF is portrayed by the best in the range from the underlying zerocross to 30 ms of the put off time since 30 ms of the ACF concede time identifies with the lower repeat most distant purpose of the pitch figure shown in [48, 49]. An isolated signal with a lower center repeats underneath 100 Hz, at times giving an ACF peak with a concede longer than 30 ms. In such case, the essential best inside the possible most noteworthy concede time (200 ms is central for the e calculation depicted underneath) is distinguished. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 % fs: sampling frequency % acf is two dimensional (delay time % and the amplitude) % the first zero-cross For i=1:floor(tmax*fs); tg=I;break, end end %.................................................................. % peak within the maximum delay (tmax) %.................................................................. For i=tg:floor(tmax*fs)-1 If acf(i,2)>acf(i+1,2)&&acf(1,2)>acf(i-1,2) P_tau(i,[1 2])=acf(I,[1 2]); I_tau=find(p_tau(:,2)); P_tau=p_tau(i_tau,:); end end [phi1,i_tau]=max(p_tau(:,2)); Tau1=p_tau(i_tau,1); %.................................................................. %peak within 30 ms %.................................................................. For i=tg:floor(0.030*fs)-1 If acf(I,2)>acf(i+1,2)&& acf(I,2)>acf(i-1,2) P_tau(I,[1,2])=acf(I,[1 2]); I_tau=find(p_tau(:,2)); P_tau=p_tau(i_tau,:); End End [phi1,i_tau]=max(p_tau(:,2)); Tau1=p_tau(i_tau, 1); AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS 127 τe : The ten-percentile envelope spoil of the ACF, delineating the level of diligence of the signal. It is figured from backslide and extrapolation of the adjacent maxima of the fundamental bit of ACF. On account of a wide assortment of the basic ACF envelope decay, the iterative procedure, which picks the best-fit-backslide line among a couple of choices, is displayed. The point by guide framework toward getting τe by the iterative procedure is depicted in Granger. W ϕ(0): The fifty-percentile width of the ACF adequacy around the commencement of the defer time, relating to the timbre insight [6]. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 % peak detection % igacf id acf in the logarithmic % scale % delta is varied from 3-50 ms in [11] %.................................................................. For i=2:10 r_taue =lgacf(floor((i-1)*delta*fs)+1: floor(i*delta*fs),[1 2]); [p_taue(I,1ii]=max(r_taue(:,2)); P_taue(I,1)=r_taue(ii,1); End Index_taue=find(p_taue(:,2)); R=p_taue(index_taue,:); Reg0=polyfit(r(:,1),r(:,2),1; Taue-1000*(-10-reg0_(1,2))/reg0(1,1); %.................................................................. % correlation coefficient of the regression line which is the % criteria of the iterative method %.................................................................. Corr=-corrcoef(r(:,1),r(:,2)); For i=2:floor(tmax*fs)-1; If acf(I,2)<0.5 Tg2=i Break, End End Pls=acf(tg2-1:tg2,:); W_phi0= 2*interp1(pls(:,2),pls(:,1),0.5,’cubic’); IACC and τIACC : By relating to the apparent source width (ASW) and the horizontal sound localization, the delay time for the magnitude (amplitude) of the IACF and the intraoral time delay is within ±1 ms of the delay time. 1 2 3 4 5 6 7 8 9 %.................................................................. %icaf is two dimensional (delay time and the amplitude) %.................................................................. Tau_cente = ceil(length(icaf)/2); T1_lim=ceil(tau_center-0.001*fs); T2_lim=floor(tau_center+0.001*fs); Range_icaf=icaf(t1_lim:t2_lim,:); [IACC,index]=max(range_icaf(:,2)); Tau=ccf(t1_lim+index-1,1); 128 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB WIACC : The ten-percentile width of the apex of the IACF, imparting the repeat dependence of ASW. In a general sense the WIACC is controlled by the IACF top inside ±1 ms of the concede time. In any case, a signal, especially filtered with a lower center repeat, eventually gives the peak outside the range inside ±1. In such case, the apex is perceived inside ±3 ms. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 mns0=icaf(1:t1_lim+index-1,:); mns=flipdim(mns0,1); For i=1:length(mns) Mns2(I,:)=mns(1,:); If mns(I,2)<(1-0.1)*IACC mns2(i+1,:)=mns(i+1,:); Break End End Pls=iacf(t1_lim+index-1:end,:); For i=1:length(pls) Pls2(I,:)=pls(i,:); If pls(i,2)<(1-0.1)*IACC Pls2(i+1,:)=pls(i+1,:); Break End End wpls=interp1(mns2(1:length(mn2),2),mns2(1:length(mns2),1), (1-0.1)*IACC,’cubic’); wmns=interp1(pls2(1:length(pls2),2),pls2(1:length(pls2),1), (1-0.1)*IACC,’cubic’); wiacc=abs(wpls-wmns); 4.3.3 Test of Independence Beginning late, three attentional structures have been depicted in anatomical and rational terms. These breaking points fuse irritating, sorting out, and precise idea. Response time measures can be utilized to survey the arranging capacity inside every single one of these three structures. The Attention Network Test (ANT) is relied upon to assess exasperating, masterminding, and specialist thought inside a solitary 30-min testing session that can be effectively performed by young people, patients, and monkeys. An examination with 40 regular grown-up subjects shows that the ANT produces stable single subject appraisals of aggravating, sorting out, and precise point of confinement, and further proposes that the efficiencies of these three structures are uncorrelated. There are, regardless, two or three relationship in which irritating and orchestrating can adjust the level of impedance from flankers. This system may wind up being gainful and steady in looking over attentional anomalies related with instances of heart problem, stroke, schizophrenia, and a nonappearance of ability to concentrate dependably spread. The neural beginning of thought has been seen comparatively as full-scale neural systems appearing differently about dynamic spaces amidst imaging errands that require thought and domains, which, when harmed, pass on attentional insufficiencies AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS 129 [24, 25]. Posner and Petersen [24] have combated the thought that the farthest point of these differing cerebrum zones can be steadily isolated into locale related with the wellspring of thought and zones in which thought has its impact on particular sorts of data dealing with specific (areas). For instance, under two or three conditions, thought can influence the essential visual cortex; at any rate, the wellspring of this impact may lie somewhere else [26, 27]. Dismissing the path, there has been some assertion that attentional impacts might be an aftereffect of contention inside many separated identity areas [28]. Advanced examinations have demonstrated clear confirmation that a best down system began even before the associate with the use to bits of help [29, 30]. These structures do the parts of cautioning, sorting out, and precise control. Exasperating is depicted as accomplishing and keeping up an alarm state; organizing is the determination of data from material information, and specialist control is portrayed as settling hardship among reactions. The aggravating structure has been associated with the frontal and parietal areas of the right portion of the equator in light of how that productive execution and attentiveness assignments actuate different levels of sharpness, and such undertakings endorse the frontal and parietal locales of the privileged half of the globe. This is acknowledged to be an immediate aftereffect of the cortical scrambling of the mind’s norepinephrine structure (NE) [31, 32]. The engineering structure has been associated with areas of the parietal and frontal folds. Organizing is controlled by giving a hint where in space a man ought to go, in this way offering a beginning to the individual to oversee thought concerning the hailed locale either clearly by moving the eyes or secretively with no eye change [33]. The unrivaled parietal projection in people is positively identified with the parallel intraparietal space (LIP) in monkeys, which is known to pass on eye upgrades [34]. Right when an objective happens at an uncured zone and thought must be separated and moved to another region, there is action in the temporal-parietal intersection point [36]. We have in like manner adjusted a variety of the whole idea of Network Test (ANT) for fMRI considerations. The objective of the present research is to build up this work to build up a social errand which 1. Unmistakably constellates every single one of the three attentional systems, 2. Could be utilized to get a degree of the effectiveness of every single one of the structures, and 3. Is sufficiently immediate to get information from kids, patients, and creatures. The difference in such a measure would make it conceivable to choose whether the three structures are free or if the advancement of one system relates or is associated with trade structures. A near undertaking could likewise be utilized with occasionrelated accommodating imaging to consider the mind regions attracted with all parts of the errand. The company could then be used to show which of the systems may work has been done in this domain to treat the clinical patients. The test could correspondingly be used to assess the impact of social [37] and pharmacological [38] mediations on every last one of the systems. Lastly, the test could likewise fill 130 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB in as a phenotype for hereditary examinations intended to pick the wellsprings of individual groupings in making it feasible [39, 40]. The ANT, addressed in Figure 4.7, is a blend of the hailed response time (RT) [33] and the flanker error [41]. Figure 4.7 Error rates identification. Effectiveness of the three attentional systems is surveyed by assessing how reaction times are influenced by admonishing signs, spatial prompts, and flankers. Figure 4.7(a) demonstrates the four signal conditions. Figure 4.7(b) displays the six targets underpin. Figure 4.7(c) follows the time course of a key utilizing a spatial signal with incongruent flankers. Table 4.1(a) and Figure 4.7(a) gather RT information pooled from audit basics in Sessions one and two as a part of inducing and flanker condition. Slip rates are shown in Table 4.1(b) and Figure 4.7(b). A first examination displayed no distinction between left-pointing and right-pointing focuses in any situation, so they were joined. An arrangement of enthusiastic subtractions (portrayed underneath) was utilized to survey the sufficiency of the three attentional structures. The exasperating impact was found by subtracting the mean RT of the twofold signal conditions from the mean RT of the no-quick conditions. Neither of these conditions gave data about whether the objective stun would show up above or underneath the obsession point. Precisely when no notice sign appears, it tends to stay diffused over the two potential target districts. The twofold signal was utilized in light of the way that it additionally tends to keep thought distributed between the two possible target zones while irritat- AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS 131 ing the part to the inevitable appearance of the objective. The mean exhorted impact was 47 msec with a standard deviation of 18 msec. Table 4.1 MeansRT and error rates under each condition. The middle sign was utilized as a control since, similar to the single incite, it desires engineering regard for one zone. The organizing influence had a mean of 51 msec with a standard deviation of 21 msec. The contention (precise control) significance was discovered by subtracting the mean RT of all agreeable flanking conditions, summed crosswise over completed sign sorts, from the mean RT of incongruent flanking conditions. The use of unbiased, as opposed to amicable, flanking terms, would create a comparable result because there were merely little differences between the excellent flanker and the neutral flanker conditions. The mean clash influence was 84 msec with a standard deviation of 25 msec. In relationship analyses the two goals of the affiliation examinations were (a) to choose if every 30-min test session gave a substantial proportion of the gainfulness of the three systems for singular subjects, and (b) to survey paying little regard to whether subjects’ ampleness inside every last one of the structures was thought about. Table 4.2 shows the associations among extents of the three attentional frameworks and constellates a connection between each thought measure and for the most part mean RT. Connections between the two sessions for a particular part give a check of unfaltering quality to individual subjects. Assessments for each one of the three frameworks and the general RT made colossal test-retest steadfastness. The associations between the three segments gave one technique for looking liberally over the systems. After examination of Variance (ANOVA), we finished a 4 (incite condition: no sign, focus sign, twofold signal, spatial instigate) 3 (flanker frame: fair, great, incongruent) ANOVA of the RT information found in Table 4.1 and Figure 4.7(a). There were fundamental things that impacted incite condition [F (3, 117) = 291.99, p < 0.001], and flanker shape [F (2, 78) = 438.86, p < 0.001]. 132 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Table 4.2 Relations between different networks and test sessions. In addition, there was a gigantic connection between prompt condition and flanker make [F (6, 234) = 17.43, p < 0.001]. The likelihood of the association is instantly evident in Figure 4.7(a). Under every inciting condition, the vicinity of incongruent flankers expanded RT, regardless; this impact was refreshed when subjects were given exhorted signs (focus or twofold signals) that contained no spatial data. A 4 3 ANOVA on accuracy scores, compacted in Table 4.1(b), uncovered just a standard impact of flanker make [F (2, 78) = 42.62, M SE = 0.00, p < 0.001]. Planned divisions demonstrated a fundamental capability between incongruent flankers versus the joined states of relentless and fair flankers [F (1, 39) = 46.90, M SE = 0.00, p < 0.001]. Besides, the difference among agreeable and unbiased condition was moreover immense [F (1, 39) = 7.49, M SE = 0.00, p < 0.01]. At the point when all is said in done, the precision data were unsurprising with the RT data in showing that incongruent flanking intruded with the getting ready of the goal. 4.3.3.1 Task Design We have obtained a degree of the activity of every single one of the three attentional systems inside a solitary undertaking requiring about a half hour to administer. Our past push to examine these impacts going when the idea procedure treatment for patients with close brain injury required around 3 hr [36]. In addition, our new objective is clear, that is to develop an age-fitting change for young people as energetic as four years of age. The going to the subjects requires that they realize how to press a left key for a leftward-pointing container and a right key for a rightward-pointing container. There is basic affirmation that the bothering and needs to be removed and arranging prompts would work even with no energy [42]. AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS 4.3.3.2 133 Steady Quality The insightful subtractions give three numbers that together outline the ampleness of every last one of the three attentional systems. While the harsh RT is exceedingly thought about over the two sessions (0.87), the subtractions are less stable. The instructed system has each one concerning the stores of being the base reliable with a test-retest relationship of (0.52); anyway, the precise control plan is the most stable (0.77), and the masterminding structure is broadly engaging (0.61). 4.3.3.3 Independence We started with the perception that three wellsprings of thought, cautioned, sorting out, and the precise idea, seem to draw in discrete identity systems. One way we used to survey the practical adaptability of these three structures was to look at how related these three practicality measures were over the 40 subjects endeavored. Results exhibit no association between any blend of prompted, sorting out, and exchange off, proposing that these are in every practical sense symmetrically made. Another degree of self-govern fuses the ANOVA approach, examining whether there are essential exchanges between the fundamental factors that impact the aggravating structure (closeness or nonattendance of signs without spatial data), the masterminding system (nearness or nonappearance of prompts with spatial data), and the precise control deal with (incongruent versus neighborly or reasonable flankers). Precisely when an irritating sign with no spatial data was demonstrated previously, the extent of flanker check was upgraded concerning the no-quick and spatial-affect conditions. This quantifiable coordinated effort between factors confirmed that the systems don’t work all around, self-ruling in all conditions. It is conceivable that the trades can be addressed like particular properties of the errand. Use of spatial signs, which empower people to control thought as for the outside help early, could reduce the impact of the wrapping flankers. The lessened flanker check in the no-cue condition is additionally astounding. We expected both the no-quick and twofold signal conditions to make a simply diffuse idea and along these lines anticipated that both would have a similar flanker impedance. The no-quick condition is a generally low-sharpness condition and accomplished longer RTs and lower spoil rates. This speed-exactness tradeoff is standard for the impact of accessibility on RT [24]. In past examinations, it has been demonstrated that data was produced at a relative rate, paying little respect to the level of sharpness; in any case, the measure for a reaction is more stringent when the status is low. It is conceivable that the more pulled in our time to pass on a reaction under low sharpness can give an extra chance to precise idea shapes in the contention condition, and in this way, the distinctions among perfect and incongruent flanker conditions are diminished. We have lately started finishing another examination utilizing the ANT with seven-year-old kids. The analysis clarifies that to refine the evaluation of comparison between youngsters and grown-ups, our analysis explained that evaluation should be on an extremely fundamental level, the same for comparative information. The youngster modification gave no check for both of the correspondences found in the grown-up information. In addition, bolstering the independence of these structures under a few conditions starts from an examination of sorting out and the traditional shading Strop influence [43], in which 134 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB the two impacts were found not to interface. The observation was that there are a few correspondences between the structures, suggesting that they may not wind up being free in every last direct thought, despite the manner in which they utilize obvious life systems and compound modulators. 4.3.3.4 Eye Movements One possible clarification behind the two associations found in the adult takes into account that for the most part there was a high-sharpness demand for the jolt type of the errand. We didn’t control for eye improvements because the way created by Corbetta and accomplices (e.g., Corbetta et al. [43] showed that plain and undercover developments of thought use a comparative life framework. Regardless, we ran a few subjects either under the rule to avoid eye improvements, as in the full examination depicted in this chapter, or with no course to take care of fixation. Under the rule to take care of fixation, eye improvements were by and large remarkable (around 3-5%, everything considered). Exactly when no rule was given, eye improvements were outstandingly typical. RT emitted an impression of being speedier in eye-improvement primers; regardless, the major effects of prompts and target on a very basic level looked the same. The collaborations found in the full examination were probably not in light of eye improvements but, instead, are likely influenced by a marvelous course of action by the astute solicitations of the errand. 4.3.3.5 Unwavering Quality and Practice In this examination, the proper framework measure was substantially stronger than the others. This is no doubt as a result of how that alerted and masterminding were exhibited by signals while the precise limits were evaluated directly by the task. There is a level of decision in the use of the signs that may have decreased their constancy. While arranging as controlled by authenticity limits, it might be more tried and true; clearly, it would require more various starters. Sound-related ominous signs regularly make more modified advised than do visual prompts and they may serve to help the reliability of the disturbing control. The system used to gauge quality endurance ambiguous results since the second session unquestionably included more practice than the first. Regardless, there is little insistence that there are bona fide rehearse impacts in this assignment since the refinement scores did not change on an extremely fundamental level between sessions, despite the way that the general RTs of the second session were speedier than that of the basic session. 4.3.3.6 Future Studies We are at present utilizing the ANT in various tireless examinations. One of them joins a variety of changes that pull in young people in a distraction utilizing pointed goldfish as the objective and flankers. Key outcomes with kids fortify a large piece of the disclosures in this examination, yet no relationship among incite and target was found. Another objective is to utilize this errand to outline the accomplishment of endeavors to make recovery techniques. Sturm et al. [44] thought that rehabilitative methodologies should be locked into particular attentional systems and that a few structures can’t be balanced without first changing differing structures (also see [36]). The test ought to permit evaluation of these insights. AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS 135 A development of this consideration is to utilize the errand to take a look at the impacts of different sorts of attentional headings. Concentrates with alarm monkeys have related every last one of the structures with particular neural connections. By virtue of prompt result, inadequate NE structures prevent the fundamental effect of prepared signs [32]. Blends of scopolamine into the LIP zone have been shown to unequivocally impact planning [45], endorsing the relationship of this structure to acetylcholine (ACh). At long last, the chief cingulate and the level frontal cortex are target territories of the ventral tegmental dopamine framework. We accept that individual contrasts in the systems may result from contrasts in genotypes [37] identified with these structures. The relationship among structures and specific blend modulators proposes appropriate measures concerning which polymorphisms will be identified with each attentional system. We have made the immediate measure utilizing both the E-Prime bundle and Java applets for conceivable execution on an IBM PC. 4.3.4 Linear Autoregressive Models Thoughts about the connection between autoregressive displaying and straight expectation have been shown in this case. The two distinct issues which can yield comparable numerical outcomes are straight expectation and autoregressive displaying. The parameters of a straight channel can be resolved, and this is an ultimate objective in the two cases. Consequently, the channel utilized in every issue is unique. On account of the straight forecast, the aim is to decide a FIR channel that can ideally foresee future examples of an autoregressive procedure in light of a right blend of past examples. The contrast between the precise autoregressive signal and the anticipated signal is known as the expectation mistake. In a perfect world, this error is repetitive sound. For the instance of autoregressive displaying, the aim is to decide on an all-shaft IIR channel, that when energized with repetitive sound, a signal is transmitted with indistinguishable measurements with reference to the autoregressive model we are trying to demonstrate. 4.3.4.1 Make an AR Signal using an All-Pole Filter with White Noise as Input Here we utilize the LPC work and a FIR channel basically to think of parameters we will use to impact the autoregressive signal we will work with. The utilization of FIR1 and LPC are not fundamental here. For instance, we could supplant d with something as basic as [1 1/2 1/3 1/4 1/5 1/6 1/7 1/8] and p0 with something like 1e−6 . Nevertheless, the state of this channel is additionally beguiling, so we utilize it. 1 2 b = firl(1024, .5); [d,p0] = lpc(b,7); To pass on the autoregressive standard, we will empower an all-post channel with white Gaussian racket of separation p0 . Notice that to get change p0 , we ought to use SQRT (p0 ) as the “gain” term in the uproar generator. 136 1 2 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB rng(0, ’twitter’); u = sqrt(p0)*randn(8192,1); We use the white Gaussian noise hail and the all-present channel on delivering an AR signal. 1 x= filter(1,d,u); 4.3.4.2 Discover AR Model from Signal Utilizing the Yule-Walker Method Settling the Yule-Walker conditions, we can pick the parameters for an all-post channel that when engaged with foundation object makes an AR signal whose experiences arrange those of the given standard, x. At last, this is called autoregressive showing up. When recalling a conclusive focus to settle the Yule-Walker conditions, it is essential to check the autocorrelation uttermost ranges of x. Levinson figuring is used by then to understand the Yule-Walker conditions advantageously. The most distant point ARYULE does this for us. 1 [d1,p1] = aryule(x,7); 4.3.4.3 Compare AR Model and AR Signal To start with, we exhibited the AR hail x to process the repeat response of the all-post channel. It is striking that the inadequate power thickness of the yield of this channel, when the channel is propped with white Gaussian model, is given by the least squared of its recurrent reaction replicated by the refinement of the established evaluation. One approach to manage administer figure which yields control with remarkable thickness is by utilizing FREQZ as takes after: 1 [H1,w1] = freqz(sqrt(p1),d1); Recalling an authoritative focus to get an idea of how well we have shown the autoregressive signal x, we overlay the power nebulous vision thickness of the yield of the model, organized using FREQZ, with the power inadequate thickness check of x, figured using PERIODOGRAM. Notice that the PERIODOGRAM is scaled by 2 ∗ pi and is uneven. We need to alter this for confined result: 1 2 3 4 5 6 7 8 9 10 periodogram(x) hold on % Scale to make one-sided PSD hp = plot(w1/pi,20*log10(2*abs(H1)/(2*pi)),’r’); hp.LineWidth = 2; xlabel(’Normalized frequency (\times \pi rad/sample)’) ylabel(’One-sided PSD (dB/rad/sample)’) legend(’PSD estimate of x’,’PSD of model output’) AUTOCORRELATION, TEST FOR INDEPENDENCE, LINEAR AUTOREGRESSIVE MODELS Figure 4.8 4.3.5 4.3.5.1 137 Density estimate for power spectral. Linear Prediction and Autoregressive Modeling Use LPC to Perform Linear Prediction We now turn to the linear prediction problem. Here we try to determine an FIR prediction filter. We use LPC to do so, but the result from LPC requires a little interpretation. LPC returns the coefficients of the entire whitening filter A(z), this filter takes as input the autoregressive signal x and returns as output the prediction error. However, A(z) has the prediction filter embedded in it, in the form B(z) = 1− A(z), where B(z) is the prediction filter. Note that the coefficients and error variance computed with LPC are essentially the same as those computed with ARYULE, but their interpretation is different. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [d2,p2] = lpc(x,7); [d1.’,d2.’] %.................................................................. % Result %.................................................................. ans = 8x2 1.0000 1.0000 -3.5245 -3.5245 6.9470 6.9470 -9.2899 -9.2899 8.9224 8.9224 -6.1349 -6.1349 2.8299 2.8299 -0.6997 -0.6997 We now extract B(z) from A(z) as described above to use the FIR linear predictor filter to obtain an estimate of future values of the autoregressive signal based on linear combinations of past values. 1 xh = filter(-d2(2:end),1,x); 138 4.3.5.2 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Look at Actual and Predicted Signals To get a propensity for what we have finished with a 7-tap FIR to want channel, we plot (200 samples) of the important autoregressive pennant near to the standard survey working out as intended in perspective of the quick pointer remembering the one-case delay in the guess channel. 1 2 3 4 5 6 7 cla stem([x(2:end).xh(1:end-1(]) xlabel(sample time’) ylabel(’signal value’) legend(’Original autoregressive signal’, ’signal from linear predictor’) axis([0 200 -0.08 0.1]) Figure 4.9 4.3.5.3 Density estimate for periodogram spectral. Look at Prediction Errors From LPC, the conjecture ambiguous control (change) is returned as the second yield. Its regard is (hypothetically) equivalent to the differences in the slow signal through the all-coordinate facilitate in the AR showing issue (p1 ). To process this alteration in another manner is from the desired error itself: 1 p3 = norm(x(2:end)-xh(1:end-1),2)ˆ2/(length(x)-1); All of the following values are theoretically the same. The differences are due to the various computation and approximation errors herein. 1 2 3 4 5 6 7 [p0 p1 p2 p3] %.................................................................. %Result %.................................................................. ans = 1x4 10-5 x 0.5127 0.5305 0.5305 0.5068 MUTUAL INFORMATION AND TEST FOR INDEPENDENCE 4.4 139 Mutual Information and Test for Independence Using a recently discovered method for making unpredictable picture groupings with supported change counts, we show a right unscientific hypothesis significance test (NHST) for basic information between two subjective components, the invalid hypothesis being that the mutual information is zero (i.e., self-governance). The right tests reported in the composition acknowledge that data tests for each factor are successively self-governing and indistinctly passed on (iid). When in doubt, time game plan data have conditions (Markov structure) that mishandle this condition. The figuring given in this paper is the essential right endurance preliminary of shared information that considers the Markov structure. Exactly when the Markov organize isn’t known or is uncertain, a right test is used to choose a suitable Markov orchestrate. A data theoretic estimation of reliance between two irregular factors is characterized as shared data. The mutual information (in bits) of two discrete subjective components X and Y is portrayed as p(x, y) (4.11) p(x, y)log2 I(X; Y ) = p(x)p(y) x∈X y∈Y Zero reliance occurs if and only if p(x, y) = p(x)p(y); generally I(X; Y ) is a positive total. In this study we are excited about the case that the minor and joint probabilities are not known heretofore, yet rather are approximated from information, so proportions of I(X; Y ) won’t be conclusively zero when X and Y are free. Similarly, for a specific ultimate target to settle on a choice about whether I(X; Y ) > 0, a centrality test is fundamental. An essentialness test enables an expert to demonstrate the stringency for dismissal of the invalid theory I(X; Y ) = 0. The issue of picking optimal choices of reliance can be masterminded as a chi-squared test or as an exact test (for example, Fisher’s test or sorting tests). Eventually the exact evaluation is essential to create the prediction back to back information tests are drawn independently from indistinct courses (iid). Everything considered, time strategy information has conditions (Markov structure) that negate this condition. In this section, we give the right main importance fundamental of shared data that considers the Markov structure. 4.4.1 Testing the Significance of the Null Hypothesis I(X; Y )=0 To present the need for a criticalness test, acknowledge that the optional segments X and Y are the attributes obtained from the moves of a couple of six-sided dice, each fiercely independent from the other and equivalently slanted to project on any of its six sides. In the motivation behind the restraint of depleting information, the normal data among X and Y utilizing Equation (4.11) is zero. In Figure 4.10, we plot the postponed outcome of a numerical excitement of 10,000 basics of 75 rolls each; the level focus is I(X; Y ), and the vertical focus is the likelihood dissipating. The marginal’s p(x) and p(y) in Equation (4.9) are surveyed by checking the measure of events of every single one of the six pictures 1, 2, 140 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB 3, 4, 5, 6 for each pass on and restricting by the aggregate size of the dataset (75). So, moreover, the joint likelihood p(x, y) is picked up by checking the measure of events of every single one of the conceivable stimulates of the holder respect sets, pictures {(1, 1), (1, 2), .., (6, 6)}, isolated by the aggregate dataset measure. Tendency fix is routinely utilized. The system we give here for significance testing is reasonable for any decision of inclination modification. Figure 4.10 Plottings of the estimate. In Figure 4.10, shared data between couples of self-decision loops moved 75 times. I am dispersing enrolled from Equation (4.11) more than 10,000 starters (reliable line). The dashed line indicates centrality level = 0.05. Open circles are examinations of the radiate from 10,000 stage surrogates of a solitary starter. The no doubt estimation of ordinary data is 0.3 bits/move, which if we didn’t know better may appear to be fundamental considering that the aggregate vulnerability in one cycle is log2 6 ≈ 2.585 bits. The total centrality of I, all things considered, must be settled knowing the task I(X; Y ) for self-decision representation (active line, Figure 4.9). Knowing this scrambling, we would not regard an estimation of I = 0.3 as being value, since the assessments of I around 0.3 are static, while in transit toward dynamic when X and Y are independent. The strategy for thinking we are depicting is that of an invalid speculation mass test (NHST) for ordinary data, the invalid hypothesis being that the shared data is zero. The likelihood of getting contemplates I(X; Y ) respect, or one more noteworthy, is the p-respect, and the p-respect at which we oust the invalid theory is the imperativeness level, customarily inferred by α. A centrality level of α = 0.05 gathers that we eject the invalid hypothesis if the p-respect isn’t definitely or proportionate to 0.05. For the dice description, ejection would happen at I ≥ 0.42 if α = 0.05. To be clear, the p-respect is the likelihood, strengthened by the invalid hypothesis, of the essential data accomplishing its observed estimation or more value. (It isn’t the likelihood of the invalid speculation being right.) While a little p-respect drives one to dismiss the invalid thought of self-administration, an expansive p-respect suggests that the information is evident with the invalid speculation, not that the invalid hypothesis ought to be perceived. MUTUAL INFORMATION AND TEST FOR INDEPENDENCE 4.4.2 141 Producing the Mutual Information Distribution from Surrogates To play out a NHST we have to know the scattering of the test estimation given the invalid speculation. Re-reviewing is a methodology that makes distinctive data sets intimated like this as surrogates for the necessary information. For a privilege NHST, proxies need to meet two conditions: 1. The invalid speculation must be genuine for the surrogates; and 2. From one to another point, they should take after the essential information. By excellence of value evaluation, these conditions can be met precisely by emotionally permuting the sections of X and Y. Stage annihilates any reliance that may have existed between the datasets yet guards picture frequencies. In Figure 4.10, the active line is the honest to goodness diffusing of I evaluated from 10,000 starters of 75 information focus each. The open circles are the invalid theory stream assessed from 10,000 stage surrogates of an only time game-plan of 75 server farms. Likewise shown in Figure 4.10 is the importance level, α = 0.05 (dashed line), happening at around I = 0.42. Assessed I respects that are indistinguishable to or more undeniable than 0.42 (shaded region) require dismissal of the invalid theory that the values are free. Notice that α = 0.05 prescribes a five for the believability of mistakenly dismissing the invalid speculation, known as a Type I error. Chopping down the centrality level decreases the Type I error rate, yet likewise reduces the affectability of the test. Regardless, an immaculate NHST test will have a Type I error rate equivalent to the essentialness level. For a free pass on the situation, we repeated the starter 10,000 times and discovered 503 ejections of the invalid theory, separated and the run of the mill number of dismissals 10, 000 × 0.05 = 500. A similar technique to figure cure p-values is to plan believability tables and utilize Fisher’s exact test in [3, 6]. The sections cij of the probability table are the events (xn , yn ) = (I, j) which are found in the information. The table parts, adjacent with the line and territory wholes, depict the joint and insignificant probabilities, independently, and as requirements for the primary data I. The likelihood of getting the watched believability table is tantamount to the measure of conceivable groupings having the attended credibility table isolated by the action of understandable movements having the watched line and piece wholes. For id information, the likelihood of getting a specific schedule is given by the hypergeometric scrambling. At long last, the p-respect is secured by summing up the probabilities of all tables with I respects equivalent to or more evident than the watched I appreciate. In this specific situation, tallying tables is comparable with checking groupings with settled marginal, neither of which is remotely reasonable alongside negligible educational gatherings. As opposed to Fisher’s exact test, the stage test requires just a uniform looking into from the strategy of movements with settled marginals, rather than a full assurance. The correct p-see is approximated as a few tests that have shared data proportionate to or more observable than the watched I. Basically, 10,000 surrogates are adequate to play out the NHST when α = 0.05. 142 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB Representing Markov Structure Stage surrogates save single picture frequencies at any rate, not distinctive picture (or word) frequencies. For the dynamic values, which are iid, this methodology is superbly sufficient, yet when all is evaluated, we should consider that future states may rely on present and past states. We utilize the running with 6 × 6 change likelihood cross area for each pass on: ⎛ ⎞ 0.25 0 0.5 0.25 0 0 ⎜ ⎟ ⎜ 0.25 0.5 0.25 0 0 0 ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ 0 0.25 0.5 0.25 0 0 ⎟ ⎜ ⎟ T =⎜ (4.12) ⎟ 0.25 0 ⎜ 0 0 0.25 0.5 ⎟ ⎜ ⎟ ⎜ 0 0 0 0.25 0.5 0.25 ⎟ ⎝ ⎠ 0.25 0 0 0 0.25 0.5 where Tij is the advancement probability of going from the state I to state j. The entropy rate for each dynamic value is 1.5 bits/roll. As shown in Figure 4.11, regular information between two or three free Markov dice moved 150 times. Figure 4.11 Markov plottings. We utilize redirection to find the veritable course for I(X; Y ) enduring the invalid speculation, this time using 10,000 preliminaries of 150 rolls each. The outcomes are plotted in Figure 4.11. For this condition, the change apportioning, being uneven towards more modest qualities, does not fit the confirmed disseminating. Utilizing stage surrogates, the no uncertainty watched usual data respect (I ≈ 0.2) would incite an off-course dismissal of the invalid speculation at a noteworthy level of α = 0.05. To make an actual test, the surrogates should be obliged with an ultimate target that a single picture considers as well as the tallies of anchored back-to-back picture sets. By protecting the tallies of both individual and dynamic view joins, the headway likelihood of the surrogate groupings is made dubious to that of the watched approach. SPURIOUS CROSS-CORRELATION, VECTOR AUTOREGRESSIVE MODELS AND DYNAMIC REGRESSION MODELS To be more far-reaching, let xk = xn , xn−1 , .., xn−k ∈ Xk+1 exhibit a(k + 1)length word and let N (xk ) be the measure of such words shown in the information. A surrogate of Markov plan k is one that unquestionably has the same N (xk ) as the primary information. A surrogate of Markov that arranges zero is gotten by coordinate change. In the Appendix, we give an estimation capable of making surrogate groupings with holding word checks N (xk ) for any k ≥ 0. For a correct fundamental of I(X; Y ) = 0 invalid theory, the Markov request of the surrogates must match the interest of the information. Understanding that our Markov dice are sort out one, we make the right invalid theory scrambling from surrogates of interest one (Figure 4.11, open triangles). Performing 1000 preliminaries utilizing request guaranteeing surrogates we discovered 44 Type I errors, which is according to the customary number of 1000 × 0.05 = 50. Fundamentally, the stage test, which does not anchor Markov sort out, acknowledged 489 Type I errors! Utilizing stage NHSTs inside observing Markov structure yields invalid findings. The figuring portrayed in the Appendix can be changed to recognize each arrangement of a given Markov request and given marginals. The correct p-respect is the division of such movements that have fundamental data more imperative than or indistinguishable from the watched I. Essentially, more obligingly, the figuring can in like manner give uniform surveying of the arrangement of such movements with the target that the hidden couple of digits of the correct p-respect can be gotten rapidly. To the best of our understanding, this is the necessary profitable procedure for playing out a right criticalness starter of the invalid hypothesis that I(X; Y ) = 0 when the systems are not iid. 4.5 Spurious Cross-Correlation, Vector Autoregressive Models and Dynamic Regression Models 4.5.1 Cross Correlation We can implement Cross Correlation using the function xcorr by using MATLAB and we will also apply the function code by using MATLAB. Syntax r = xcorr(x,y) r = xcorr(x) r = xcorr(___,maxlag) r = xcorr(___,scaleopt) [r,lags] = xcorr(___) Description r = xcorr(x,y) restores the cross-relationship of two discrete-time groupings, x and y. Cross-affiliation evaluates the similarity among x and moved (slacked) duplicates of y as a segment of the slack. In the event that x and y have specific lengths, the point of confinement affixes zeros toward the entire of the shorter vector, so it has a similar length, N, as the other. 143 144 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB r = xcorr(x) restores the autocorrelation social event of x. In the event that x is a packaging work, by then r is a framework whose sections contain the autocorrelation and cross-affiliation movements for all mixes of the segments of x. r = xcorr(___,maxlag) from maxlog to maxlog, obliges the slack range, and in light of this accentuation, it can recognize a few data groupings. Maxlag is insinuated as N − 1. r = xcorr(___,scaleopt) also chooses a systematization elective for the cross-relationship or autocorrelation. Any choice other than ’none’ (the default) requires x and y to have a near length. [r,lags] = xcorr(___) in like manner restores a vector with the slacks at which the associations are taken care of. Two sensors at various zones measure vibrations caused by autoregression as it crosses an expansion. Load the signs and the case rate, (.) Put aside a couple of minute’s vectors and plot the signs. The standard from Sensor 2 gets in contact at a prior time than the pennant from Sensor 1. 1 2 3 4 5 6 7 8 9 10 11 12 13 load sensorData t1 = (0:length(s1)-1)/Fs; t2 = (0:length(s2)-1)/Fs; subplot(2,1,1) plot(t1,s1) title(’s_1’) subplot(2,1,2) plot(t2,s2) title(’s_2’) xlabel(’Time (s)’) Figure 4.12 Parameters of new functions. SPURIOUS CROSS-CORRELATION, VECTOR AUTOREGRESSIVE MODELS AND DYNAMIC REGRESSION MODELS When compared with the lag, the function called cross-correlation of two measurements is greatly maxima and is equal to the function of delay and plots the cross-correlation. 1 2 3 4 [acor,lag] = xcorr(s2,s1); [˜,I] = max(abs(acor)); lagDiff = lag(I) lagDiff = -350 1 timeDiff = lagDiff/Fs timeDiff = -0.0317 1 2 3 4 figure plot(lag,acor) a3 = gca; a3.XTick = sort([-3000:1000:3000 lagDiff]); Figure 4.13 Replot status. Align the two signals and replot them. Add 1 to the lag difference to account for the one-based indexing used by MATLAB. 1 2 3 4 5 6 7 8 9 10 11 s1al = s1(-lagDiff+1:end); t1al = (0:length(s1al)-1)/Fs; subplot(2,1,1) plot(t1al,s1al) title(’s_1, aligned’) subplot(2,1,2) plot(t2,s2) title(’s_2’) xlabel(’Time (s)’) 145 146 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB 4.5.2 Vector Autoregression (VAR) Models Figure 4.14 4.5.2.1 VAR models. Types of Multivariate Time Series Models Based on linear regression, the basic multivariate time series models are described, and the moving average models along with the accompanying factors which appear in the conditions are: yt is the vector of reaction time plan factors at time t. yt has n parts. c is an anticipated vector of equalities, with n sections. ϕi are n-by-n frameworks for every I. The Φi is autoregressive frameworks. There are p autoregressive structures, and some can be made entirely out of zeros. t is a vector of serially uncorrelated enhancements, vectors of length n. The t is multivariate standard sporadic vectors with a covariance organize Σ. θj are n-by-n grids for every j. The Θj are moving run of the mill frameworks. There are q moving common structures, and some can be entirely made out of zeros. δ is a consistent vector of straight time incline coefficients, with n fragments. xt is a r-by-1 vector tending to exogenous terms at each time t. r is the measure of an exogenous blueprint. Exogenous terms are information (or other UNmodeled responsibilities), notwithstanding the reaction time strategy yt . Each exogenous arrangement shows up in all reaction conditions. SPURIOUS CROSS-CORRELATION, VECTOR AUTOREGRESSIVE MODELS AND DYNAMIC REGRESSION MODELS β is an n-by-r dependable arrangement of fall away from the faith coefficients of size r. So, the object βxt is a vector of size n. Generally, the time course of action yt and xt are conspicuous. By day’s end, if you have data, it addresses both of these courses of action. You don’t, for the most part, know the offset c, incline coefficient δ, coefficient β, autoregressive systems Φi , and moving regular grids Θj . You typically need to fit these parameters to your data. See evaluate for ways to deal with survey darken parameters. The progressions t are not discernible, at any rate in data; however, they can be unmistakable in amusements [51-58]. Econometrics ToolboxTM underpins the creation and investigation of the V AR(p) demonstrate utilizing varm and related techniques. Table 4.3 4.5.2.2 Techniques related to VARM. Lag Operator Representation There is an identical description of the right autoregressive conditions as far as slack administrators [17, 47]. The slack administrator L moves the time record back by one: Lyt = yt−1 (4.13) The administrator Lm moves the time list back by m: Lm yt = yt−m (4.14) In slack administrator shape, the condition for a SV ARM AX(p, q) display moves toward becoming (Φ0 − p i=1 Φi Li )yt = c + βxt + (Θ0 + q j=1 Θj Lj )t (4.15) 147 148 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB This equation can be written as Φ(L)yt = c + βxt + Θ(L)t where, Θ(L) = Θ0 + p (4.16) Θ i Li (4.17) Θ j Lj (4.18) i=1 and Θ(L) = Θ0 + q j=1 4.5.2.3 Stable and Invertible Models A VAR model is stable if det (In − φ1Z − φ2Z 2 − ... − φpZ p ) = 0 f or|z| ≤ 1 (4.19) This condition implies that, with all innovations equal to zero, the VAR process converges to c as time goes on. See Ltkepohl [46], Chapter 2, for a discussion. A VMA model is invertible if det (In − Θ1Z − Θ2Z 2 − ... − ΘpZ p ) = 0 f or|z| ≤ 1 (4.20) This condition implies that the pure VAR representation of the process is stable. See Ltkepohl [46], Chapter 11, for a discussion of invertible VMA models. A VARMA model is stable if its VAR polynomial is stable. Similarly, a VARMA model is invertible if its VMA polynomial is invertible. There is no well-defined notion of stability or invertibility for models with exogenous inputs (e.g., VARMAX models). An exogenous input can destabilize a model. 4.5.2.4 Building VAR Models To understand a multiple time series model, or multiple time series data, you generally perform the following steps: 1. Import and preprocess data. 2. Specify a model. Creating VAR Models to set up a model using varm: – Model Objects with Known Parameters to specify a model with known parameters. – Model Objects with No Parameter Values to specify a model when you want MATLAB to estimate the parameters. – Model Objects with Selected Parameter Values to specify a model where you know some parameters, and want MATLAB to estimate the others. SPURIOUS CROSS-CORRELATION, VECTOR AUTOREGRESSIVE MODELS AND DYNAMIC REGRESSION MODELS Determining an Appropriate Number of Lags to determine an appropriate number of lags for your model. 3. Fit the model to data. See Fitting Models to Data to use estimate to estimate the unknown parameters in your models. 4. Analyze and forecast using the fitted model. This can involve: Examining the Stability of a Fitted Model to determine whether your model is stable. VAR Model Forecasting to forecast directly from models or to forecast using a Monte Carlo simulation. Calculating Impulse Responses to calculate impulse responses, which give forecasts based on an assumed change in an input to a time series. Compare the results of your model’s forecasts to data held out for forecasting. For an example, see VAR Model Case Study. Your application need not involve all of the steps in this workflow. For example, you might not have any data, but want to simulate a parameterized model. In that case, you would perform only steps 2 and 4 of the generic workflow. You might iterate through some of these steps. 4.5.3 Coupled Dynamical Systems In this section, we examine systems of coupled dynamical frameworks where an outside driving control signal is connected to the system with a specific end goal to adjust the condition of all the individual frames to the constraining sign. By considering the control motion as the condition of a virtual dynamical framework, this issue can be examined as a synchronization issue. The primary focal point of this section is to interface the viability of such control to different properties of the fundamental diagram. For example, we consider the connection between control adequacy and the system as an element of the number of hubs in the order. For vertex-adjusted charts, if the quantity of frameworks accepting control does not develop as quickly as the aggregate number of frames, at that point the quality of the power expected to impact competence will be unbounded as the number of vertices develops. With a specific end goal to accomplish control in frameworks coupled through privately associated charts, as the quantity of structures develops, both the control and the coupling among all frameworks need to incremental. Moreover, the mathematical availability of the diagram is a marker of the fact that it is so natural to control the system. We likewise demonstrate that for the cycle diagram, the ideal approach to accomplish control is by applying control to frameworks that are roughly similarly divided. Moreover, we show that when the quantity of controlled frameworks is small, it is helpful to put the control at vertices with massive degrees, though when the amount of controlled frameworks is extensive, it is beneficial to put the control at vertices with small degrees. Finally, we offer confirmation to demonstrate that 149 150 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB applying control to limit the separations between all frameworks to the arrangement of controlled structures could prompt a more successful control. 4.6 Conclusion The associative rule plays a crucial role in any domain. It started with data mining and now we are discussing this concept in network modeling. In this chapter we shared the knowledge of network modeling with associate rules, so we call it association networks. We explained in a detailed manner how the association can happen and how that was useful for the network modeling. In this scenario we needed to discuss time series modeling. Time series modelling helps to identify the association among all the factors which are related with the sender and recipient, which also helps people communicate in a feasible manner without any disturbances. Next we discussed decomposition of the time series function and how it will affect the communication scenarios. We created samples on the hypothesis creation and also on the different time series functions used so we can better manipulate the scenarios of the communication and achieve a achievable networking path. REFERENCES 1. Cook, E. R., & Peters, K. (1981). The smoothing spline: a new approach to standardizing forest interior tree-ring width series for dendroclimatic studies. 2. Salas, J. D. (1980). Applied modeling of hydrologic time series. Water Resources Publication. 3. Ando, Y., & Raichel, D. R. (1998). Architectural acoustics: Blending sound sources, sound fields, and listeners. 4. Pandey, G., Chawla, S., Poon, S., Arunasalam, B., & Davis, J. G. (2009). Association rules network: Definition and applications. Statistical Analysis and Data Mining: The ASA Data Science Journal, 1(4), 260-279. 5. Han, E. H., Karypis, G., Kumar, V., & Mobasher, B. (1997, May). Clustering based on association rule hypergraphs. In DMKD (p. 0). 6. Chawla, S., Arunasalam, B., & Davis, J. (2003, April). Mining open source software (oss) data using association rules network. In Pacific-Asia Conference on 7. Knowledge Discovery and Data Mining (pp. 461-466). Springer, Berlin, Heidelberg. 8. SPSS, S. (2006). For Windows. Chicago, IL: SPSS Inc. 9. SAS, S. (2003). Institute Inc. SAS/IML Software: Usage and Reference, Version, 6. 10. Hegger, R., Kantz, H., & Schreiber, T. (1999). Practical implementation of nonlinear time series methods: The TISEAN package. Chaos: An Interdisciplinary Journal of Nonlinear Science, 9(2), 413-435. 11. Schlogl, A. (2002). Time Series Analysis-A toolbox for the use with Matlab. Technische Universitt Graz. URL http://www.dpmi.tu-graz.ac.at/school/Matlab/tsa. CONCLUSION 151 12. McCullough, B. D., & Renfro, C. G. (1998). Benchmarks and software standards: A case study of GARCH procedures. Journal of Economic and Social Measurement, 25(2), 59-71. 13. Granger, C. W. (1966). The typical spectral shape of an economic variable. Econometrica: Journal of the Econometric Society, 150-161. 14. Cook, E. R., Briffa, K. R., Meko, D. M., Graybill, D. A., & Funkhouser, G. (1995). The’segment length curse’in long tree-ring chronology development for palaeoclimatic studies. The Holocene, 5(2), 229-237. 15. Shumway-Cook, A., & Woollacott, M. H. (1985). The growth of stability: postural control from a developmental perspective. Journal of motor behavior, 17(2), 131-147. 16. Salas, J. D. (1980). Applied modeling of hydrologic time series. Water Resources Publication. 17. Anderson, O. D. (1992). Partial autocorrelation properties for nonstationary autoregressive movingaverage models. Journal of Time Series Analysis, 13(6), 485-500. 18. Granger, C. W. J., & Hatanaka, M. (2015). Spectral Analysis of Economic Time Series. (PSME-1). Princeton university press. 19. Fritts, H. C. (1976). Tree Ring and Climate [M 1. London, UK: Academic Press, l976, 1, 567. 20. De Boor, C., De Boor, C., Mathmaticien, E. U., De Boor, C., & De Boor, C. (1978). A practical guide to splines (Vol. 27, p. 325). New York: Springer-Verlag. 21. Cook, E. R., & Peters, K. (1981). The smoothing spline: a new approach to standardizing forest interior tree-ring width series for dendroclimatic studies. 22. Chafield, C. (1975). The analysis of time series: theory and practice. Chapman and Hull, London. 23. Ando, Y., & Raichel, D. R. (1998). Architectural acoustics: blending sound sources, sound fields, and listeners. 24. Posner, M. I., & Petersen, S. E. (1990). The attention system of the human brain. Annual review of neuroscience, 13(1), 25-42. 25. Mesulam, M. M. (1981). A cortical network for directed attention and unilateral neglect. Annals of Neurology: Precise Journal of the American Neurological Association and the Child Neurology Society, 10(4), 309-325. 26. Martinez, A., Anllo-Vento, L., Sereno, M. I., Frank, L. R., Buxton, R. B., Dubowitz, D. J., ... & Hillyard, S. A. (1999). Involvement of striate and extrastriate visual cortical areas in spatial attention. Nature Neuroscience, 2(4), 364. 27. Posner, M. I., & Gilbert, C. D. (1999). Attention and primary visual cortex. Proceedings of the National Academy of Sciences, 96(6), 2585-2587. 28. Desimone, R., & Duncan, J. (1995). Neural mechanisms of selective visual attention. Annual review of neuroscience, 18(1), 193-222. 29. Corbetta, M., Kincade, J. M., Ollinger, J. M., McAvoy, M. P., & Shulman, G. L. (2000). Voluntary orienting is dissociated from target detection in human posterior parietal cortex. Nature Neuroscience, 3(3), 292. 30. Kastner, S., Pinsk, M. A., De Weerd, P., Desimone, R., & Ungerleider, L. G. (1999). Increased activity in human visual cortex during directed attention in the absence of visual stimulation. Neuron, 22(4), 751-761. 152 STATISTICAL ANALYSIS OF NETWORK DATA USING MATLAB 31. Coull, J. T., Frith, C. D., Frackowiak, R. S. J., & Grasby, P. M. (1996). A fronto-parietal network for rapid visual information processing: a PET study of sustained attention and working memory. Neuropsychologia, 34(11), 1085-1095. 32. Marrocco, R. T., Witte, E. A., & Davidson, M. C. (1994). Arousal systems. Current opinion in neurobiology, 4(2), 166-170. 33. Posner, M. I. (1980). Orienting of attention. Quarterly Journal of experimental psychology, 32(1), 3-25. 34. Andersen, R. A., Snyder, L. H., Bradley, D. C., & Xing, J. (1997). Multimodal representation of space in the posterior parietal cortex and its use in planning movements. Annual review of neuroscience, 20(1), 303-330. 35. Corbetta, M., Kincade, J. M., Ollinger, J. M., McAvoy, M. P., & Shulman, G. L. (2000). Voluntary orienting is dissociated from target detection in human posterior parietal cortex. Nature Neuroscience, 3(3), 292. 36. Moore Sohlberg, M., McLaughlin, K. A., Pavese, A., Heidrich, A., & Posner, M. I. (2000). Evaluation of attention process training and brain injury education in persons with acquired brain injury. Journal of clinical and experimental neuropsychology, 22(5), 656-676. 37. Pelham, W. E., Gnagy, E. M., Greiner, A. R., Hoza, B., Hinshaw, S. P., Swanson, J. M., ... & McBurnett, K. (2000). Behavioral versus behavioral and pharmacological treatment in ADHD children attending a summer treatment program. Journal of abnormal child psychology, 28(6), 507-525. 38. Fan, J., Wu, Y., Fossella, J. A., & Posner, M. I. (2001). Assessing the heritability of attentional networks. BMC Neuroscience, 2(1), 14. 39. Fossella, J., Sommer, T., Fan, J., Wu, Y., Swanson, J. M., Pfaff, D. W., & Posner, M. I. (2002). Assessing the molecular genetics of attention networks. BMC Neuroscience, 3(1), 14. 40. Eriksen, B. A., & Eriksen, C. W. (1974). Effects of noise letters upon the identification of a target letter in a nonsearch task. Perception & Psychophysics, 16(1), 143-149. 41. Lambert, A. N. N., McLachlaen, A., & Aitken, V. (1999). The new component of visual orienting: Implicit effects of peripheral information and sub-threshold cues on covert attention. Journal of Experimental Psychology: Human Perception and Performance, 25, 321-340. 42. Shalev, L., & Algom, D. (2000). Stroop and Garner effects in and out of Posner’s beam: Reconciling two conceptions of selective attention. Journal of Experimental Psychology: Human Perception and Performance, 26(3), 997. 43. Corbetta, M., Akbudak, E., Conturo, T. E., Snyder, A. Z., Ollinger, J. M., Drury, H. A., ... & Shulman, G. L. (1998). A shared network of functional areas for attention and eye movements. Neuron, 21(4), 761-773. 44. Sturm, W., Willmes, K., Orgass, B., & Hartje, W. (1997). Do specific attention deficits need appropriate training? Neuropsychological Rehabilitation, 7(2), 81-103. 45. Davidson, M. C., & Marrocco, R. T. (2000). Local infusion of scopolamine into intraparietal cortex slows covert orienting in rhesus monkeys. Journal of Neurophysiology, 83(3), 1536-1549. CONCLUSION 153 46. Ltkepohl, H., & Poskitt, D. S. (1996). Specification of echelon-form VARMA models. Journal of Business & Economic Statistics, 14(1), 69-79. 47. Naicker, P., Anoopkumar-Dukie, S., Grant, G. D., Neumann, D. L., & Kavanagh, J. J. (2016). Central cholinergic pathway involvement in the regulation of pupil diameter, blink rate, and cognitive function. Neuroscience, 334, 180-190. 48. Sato, S. I., & Ando, Y. (1999). On the apparent source width (ASW) for bandpass noises related to the IACC and the width of the interaural crosscorrelation function (W IACC). The Journal of the Acoustical Society of America, 105(2), 1234-1234. 49. Sumioka, T., & Ando, Y. (1996). On the pitch identification of complex tones by the autocorrelation function (ACF) model (Doctoral dissertation, ASA). 50. Ltkepohl, H. New Introduction to Multiple Time Series Analysis. Berlin: Springer, 2005. 51. McLeod, A.I. and W.K. Li. Diagnostic Checking ARMA Time Series Models Using Squared-Residual Autocorrelations. Journal of Time Series Analysis. Vol. 4, 1983, pp. 269-273. 52. Pankratz, A. Forecasting with Dynamic Regression Models. John Wiley & Sons, 1991. 53. Phillips, P. Time Series Regression with a Unit Root. Econometrica. Vol. 55, 1987, pp. 277-301. 54. Johansen, S. Likelihood-Based Inference in Cointegrated Vector Autoregressive Models. Oxford: Oxford University Press, 1995. 55. Durbin J., and S. J. Koopman. Time Series Analysis by State Space Methods. 2nd ed. Oxford: Oxford University Press, 2012. 56. Dickey, D. A., and W. A. Fuller. Likelihood Ratio Statistics for Autoregressive Time Series with a Unit Root. Econometrica. Vol. 49, 1981, pp. 1057-1072. 57. Dickey, D. A., and W. A. Fuller. Distribution of the Estimators for Autoregressive Time Series with a Unit Root. Journal of the American Statistical Association. Vol.74, 1979, pp. 427-431. 58. Gallant, A. R. Nonlinear Statistical Models. Hoboken, NJ: John Wiley & Sons, Inc., 1987. 59. https://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin theorem 60. https://in.mathworks.com/help/matlab/release-notes-R2007b.html 61. https://www.businesswire.com/news/home/20031210005227/en/Insightful-LaunchesS-PLUS-6.2 CHAPTER 5 NETWORK ROUTING SIMULATION USING MATLAB Abstract In this chapter, we explain how network routing simulations can be done using MATLAB. Additionally, deep insights are provided about evaluation of Granger causality measures on known systems along with results. We explain application to FMRI BOLD information from a visuospatial consideration undertaking followed by various model development approaches, model validation, universal algorithms and sequential algorithms, acoustic-centric and radio-centric algorithms, AODV routing protocols, etc. Keywords: Demand modeling, universal algorithms, sequential algorithms, AODV routing protocol Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 155 156 5.1 NETWORK ROUTING SIMULATION USING MATLAB Evaluation of Granger Causality Measures on Known Systems This audit manages the examination of impacts that one structure, be it physical, preservationist, regular or social, for instance, can apply over another. In two or three reliable fields, the finding of the impact made between various frameworks is basic. As depictions, we can consider quality impact structures, relations between sparing components, correspondence between neurons or the flood of data between various identity areas, or the human effect on the Earth’s condition, and various others. The setting considered in this report is addressed in Figure 5.1 below. For a given framework, we have different distinctive estimations. In neuroscience, these can be neighborhood field potential results recorded in the mind of a creature. In sun energized material science, these can be records assessed by sensors locally opening some satellite. In the examination of angry liquids, these can be the speed assessed at various scales in the liquid (or can be as in Figure 5.1, the wavelet examination of the speed at various scales). For these undeniable cases, the truth is to discover conditions between the diverse estimations, and if conceivable, to give a scrambling toward the reliance. In neuroscience, this will permit seeing how data streams between various regions of the cerebrum. In sun-controlled material science, this will permit welcoming the relationship between archives and their effect on the aggregate sun-powered irradiance on Earth. In the examination of unevenness, this can demand the directional course of vitality from colossal down to small scales. Figure 5.1 Each middle purpose of the structure is related to a signal. Edges between focus remain for reliance (shared data) between the signs. EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 157 Climatology and neuroscience were given as cases by Norbert Wiener in 1956, in a section which provoked econometrist Clive Granger to hypothesize about what is now known as Granger causality. Wiener proposed that a standard x causes later game plan y, if the past of x impacts gauge of y, Wiener states that: “As the utilization of this, let us consider the situation where f1 (α) addresses the temperature at 9 A.M. in Boston, and f2 (α) addresses the temperature in the meantime in Albany. We in general thing considered expect that condition moves from west to east with the turn of the earth; the two wholes 1−C and its associate the other way will engage us to drive a correct verbalization containing a couple if this substance and after that check whether this disclosure is huge or not. Here the examination of coefficients of causality running the two courses and of their analogs for sets of more than two points of confinement f might be huge in comprehending what part of the cerebrum is driving what another piece of the mind in its ordinary improvement.” In a broad sense, Granger causality can be summed up as a hypothetical structure in the context of restrictive chance to audit directional conditions between time game plan. It is enchanting to see that Norbert Wiener affected Granger causality, and another field provided for the examination of conditions: data hypothesis. Data hypothesis has induced the significance of totals that measure the shortcoming of factors utilizing probabilistic considerations [1, 35]. Furthermore, this has impelled the centrality of degrees of reliance in the context of the reduction in feebleness identifying with one variable in the wake of the review of another. Standard data hypothesis is, regardless, symmetrical. For instance, the striking shared data rate between two stationary time game plans is symmetrical under a trade of the two flags: the essential data evaluates the unidirectional reliance. Directional reliance examination seen as a data theoretic issue requires the breaking of the standard symmetry of data hypothesis. This was perceived in the 1960s and mid-1970s by Hans Marko, a German teacher of correspondence. He built up the bidirectional data theory in the Markov case. This hypothesis was later summed up by James Massey and Gerhard Kramer, which we may now call information theory [1, 37-39]. Different data theoretic instruments have been proposed for the practical usage of Granger causality contemplations. We won’t indicate a large portion of the specific measures proposed, in light of how they are as often as possible specific events of the measures issued from the created data hypothesis. Also, two or three measures may have been proposed in various fields (or possibly at various eras) and have turned out to be specific names. We will necessarily consider the common muchperceived names. This is the condition, for instance, of “exchange entropy,” as made by Schreiber in 2000 [2, 20, 25-29], which, in any case, had all the earmarks of existing under various names, in various fields, and may be considered under genuinely phenomenal speculations. Prior to working up an assembled perspective of the relationship between Granger causality and data hypothesis, we will give an outline of the arrangement, focusing on considers where data theory and Granger causality are usually shown. 158 NETWORK ROUTING SIMULATION USING MATLAB Also, we won’t review any significant edges or any straightforward applications. In this spirit, this report isn’t equivalent to, and concentrated on the estimation of information wholes, and where the layout is obliged to trade entropy. We perform a survey on the different conditions on the structures and different employments of the department of neuroscience. Nevertheless, we will state of some primary viable focuses in our decisions, where we will comparatively investigate some repeating examples and future headings of research in the field. What Is, and What Is Not, Granger Causality We won’t look at the hugeness of causality or causation. Regardless, we should weight that Granger causality genuinely measures sure reliance between the past of a framework and the present of another. In such a way, the word causality in Granger causality goes up against the conventional proposition that a reason occurs prior to its impact. Notwithstanding, nothing in the definitions that we will review hinders the fact that standard x can meanwhile be Granger-caused by y and be a clarification behind y! This lies in the poor connection between Granger causality and the criticism between times strategy. Granger causality depends upon the traditional idea of adornment in likelihood theory, the methodologies we casually designed for normal examples will be used further for more probability of the occurrence of the task. In this spirit, intercession is closer to fundamental sciences, where we envision that we can truly, for instance, bond some framework and measure the impact of this development on another approach. Before long it is noteworthy that causality in the opinion between emotional factors can be started unambiguously only in compelled cases, for example, encouraged non-cyclic layout models [32]. 5.1.1 A Historical Viewpoint In 2003 the Nobel prize winner author Clive W. Grander identified that in 1959 Denis Gabor has demonstrated his work , which was considered as a sign of his area of implementation which can meet his requirements [24, 31]. Norbert Wiener’s section is about the hypothesis of want. In his complete paper, Wiener suggested that longing hypothesis could be utilized to depict causality between time blueprint. Granger also built up this thought and created a criticalness of causality and testing strategy. Granger’s causality imparts that a reason must happen before the impact and that causality concerns the extensive information. When testing for the causality of one variable on another, it is typical that the reason has data about the impact that is astounding to it; i.e., this data is dim to some other variable. Unquestionably, this can’t be checked for factors that are not known. In this way, a decision achieved in the context of a game plan of estimations can be changed if new estimations are considered. Granger’s 1969 paper does not contain much new information, but rather gives a refined presentation of the thoughts [24, 36]. In two examinations conducted in 1982 and 1984, John Geweke, another econometrician, set up a full treatment of Granger causality, which merged the probability of input and rapid coupling. In past work, the examination was compelled to the EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 159 relationship between two-time courses of action (perhaps multidimensional). In this examination, Geweke depicted a summary of causality from x to y; It is the logarithm of the degree of the asymptotic mean square error while foreseeing y from its past just to the asymptotic mean square botch while imagining y from its past and the past of x. Geweke also depicted a similar sort of record for blazing coupling. This spoil was shown in the Gaussian case, and it staystrue regardless of when the records of causality are supplanted in terms of professional career entropy rates, and the induce coupling list is supplanted by a slight suggestion regarding the data change scale. This relationship between Granger causality and encouraged data hypothesis was also bolstered by (without mentioning the prior initiation related to work) the speculation in the non-Gaussian case. Regardless, before these advancing examinations, the hypothesis of Geweke’s course of action to some far-reaching setting was spoken to in 1987, in econometry by Gouriroux et al. [3, 33], and in the work of Rissannen and Wax. Gouriroux and his partners thought about a joint Markovian delineation of the signs and worked in a choice-theoretic structure. They depicted a movement of settled hypotheses, paying little regard to whether causality was significant or not, and whether affect coupling was available or not. In another work, the methodology taken was nearer to Geweke’s examination, and it depended upon framework visible affirmation, in which the multifaceted idea of the model was considered. The likelihood measures were parameterized, and a data measure that together evaluated the estimation structure and the multifaceted thought of the model was utilized while predicting a signal. This enabled Geweke’s outcome to be stretched out to nonlinear appearing (and from now on the non-Gaussian case) and gave a data theoretic translation of the tests. In the long run, a relative sort of spoil of reliance was obtained by these creators. In the late 1990s, a few examinations started to be made in the material science mastermind on impacts between dynamical frameworks. To pick whether one matter influenced another, the thought was to think about every single one of the signs as evaluated conditions of two specific stand-out structures, and a while later to consider the ace slave relationship between these two frameworks. The impact of one framework on another was then depicted by affecting a longing for the segments in the rehashed stage to space of one of the strategies. To the degree anyone is concerned; the setting was confined to the bivariate case. A second course, which was likewise compelled to the bivariate case, was taken and depended upon data theoretic instruments. The fundamental obligations were from Palu and Schreiber, with helpful changes showing up several years later. In these examinations, the impact of one process on the other was assessed between the likelihood measures under the hypotheses of impact or no impact. Regularly, the measures depicted especially took after the measures proposed by Gouriroux et al. [3], and utilized the likelihood of restrictive fundamental data. The measure to survey whether one matter impacts the other was named exchange entropy by Schreiber. Its definition was proposed under a Markovian uncertainty. The introduction by Palu was more straightforward and did not depend upon a choice-theoretic thought. The measure depicted is, regardless, unclear to the exchange entropy. Strikingly, Palu noted in this 2001 paper that in the closest best way to deal with overseeing Granger causality is, according to him 160 NETWORK ROUTING SIMULATION USING MATLAB that “the last measure can in like be acknowledged as a theoretic data ordering of the Granger causality thought.” [4, 32, 43, 48, 51] Causality is an imperative worry in the examination of complex frameworks; the region and estimation of causal relations stir different examinations in different science regions. The establishment and significance of causality have been dependably dissected for a noteworthy period by specialists and researchers, and the fundamental considerations are set up in probabilistic hypotheses. A numerically and quantifiably far-reaching significance of causality given by Wiener constellates two substances [1, 2]: 1. The quantifiable condition, where Y causes X, showing that the differentiating probabilistic conditions get, that is, P (X) = P (X|Y ), and 2. The short-lived relations, where just an enormous time range may cause the future; at any rate the future can’t cause the past. In any case, it is hard to apply this equation after a short time for two reasons. In any case, it is hard to get P (X) without the impact of Y under normal conditions. This requires tests to be facilitated under exceedingly controlled conditions. Hereafter, we can’t pick if the likelihood surveyed from the time strategy X is P (X) or P (X|Y ). Affirmation is another issue, that is, paying little regard to whether P (X|Y ) is striking in association with P (X) must be considered. Granger causality (GC), which started from Wiener’s significance of causality and its subordinates, has been widely utilized for decades. GC utilized the gauge to decide the causality. The gauge accuracy of a joint model that stabilizes “cause” and “impact” is superior to a model of “effect” alone. Another remarkable approach is exchanged entropy (TE), which relies on the cover and segments of data transport by assessed likelihood allocation. In any case, it has been shown that TE and GC are proportional for Gaussian components and asymptotically relative for general Markov models. Moreover, data theoretic measures regularly requires a more unmistakable number of information that falls away from the faith procedures, for example, GC. Beginning late, Pearl recommended that the laws of likelihood hypothesis don’t look quickly at how one property of an allocation changes when another property is balanced; like this, causal fragments ought to be imparted in the edge of causal surmising. He proposed an aide causal model, which has turned out to be an essential idea in machine learning and man-made mental fitness. In particular, these techniques are based on probabilistic conditions. They may fuse coordinate models or data theory, and the execution if all else fails relies on the parameter’s estimation. Besides, for existed to non-stationary components, for example, in different physiological signs, the estimation of the relating parameters is in the not too distant past an open demand. To maintain a strategic distance from complex parameter estimation, this work rotates around the second truth of causality, the short-lived relations. Following the causality ramifications of Wiener and Pearl, we propose another model of causality that “impact X” will happen after a specific slack when “cause Y” occurs. Acknowledge that Fτ (X, Y ) is the joint likelihood development of X EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 161 and Y, τ gathers Y at the prior time. On the off chance that Y doesn’t cause X, Fτ won’t be all around not the same as others. Then again, if Y causes X in a slack τ , the differentiating Fτ would all around vacillate from another Fτ , for example, F0 . In this model, we recognize that the assessing rate of information is high enough with the target that τ isn’t 0, in light of how no data transmission is speedy. Along these lines, F τ is wandered from F0 with conceivable research causality. To unwind the examination, we acknowledge that X and Y are joined, just {X = 1|Y = 1} is concerned, which signifies “cause Y” and “impact X” both occurred. Just take Mτ (τ ≥ 0) to watch the occasion of affiliation (ER), which induces that X and Y are watched, where Y is put off by τ . Kτ (τ ≥ 0) is the measure of ER amidst the acknowledgment, and p(Mτ ) is the likelihood of that ER. Along these lines, association is increased to a binomial test, and Poisson test (a measure of the binomial test) is utilized for unwinding check (see Methods). We have the basic frameworks to work on for identifying the human insights depends on the probability of occurrence. The frameworks like BOLD (Blood oxygenation level dependent). This BOLD can take the signals from the framework functional magnetic resonance imaging (FMRI) which is a basic and important part of neuroscience [21-23]. Beginning with this point of view, information of learning might be acquired from BOLD signals by indisputable proof of the focuses and edges of large-scale utilitarian cerebrum systems. A fundamental questionable demand remaining in the field, regardless, is the techniques by which to best depict the focuses and edges of massive scale utilitarian cerebrum structures. Here we present a novel system for the examination of encouraged interregional sensible exchanges that depends upon the BOLD advancement of the individual voxels of region of interests (ROIs) and the Granger causality (GC) degree of the coordinated effort made between voxels. GC tests whether the longing for the present estimation of one-time game plan by its specific past attributes can be enhanced by including past estimations of later strategy in the guess. Given this is substantial, the second course of action is said to be the first Granger cause, and the level of the hugeness of the change might be taken as the idea of GC. The GC measure is ordinarily finished by methods for autoregressive (AR) appearing and has been radiated due to an impression of being an unfathomable and flexible contraption for assessing the consistency of one neural time approach from another. It has perfect conditions as an edge measure over the usually used affiliation: first, it gives the idea of accommodating collaboration between time strategy in the two headings, rather than a solitary non-directional quality; second, its set up in want engages more grounded clarifications to be made about utilitarian trades than does essential relationship. The utilization of GC to assess the supportive relationship in mind from FMRI BOLD information has turned out to generally be an excellent examination, with some engaging to encourage it and others renounced to it. In the present work, we rotate around enhancing the utilization of GC examination to FMRI BOLD information with a specific ultimate target to only more quickly value the bit of best down impacts in visuospatial thought. A past check of GC examination of FMRI BOLD information battles against the presumption of homogeneous interregional reasonable affiliations, and furthermore 162 NETWORK ROUTING SIMULATION USING MATLAB suggests that for averaging BOLD signs, as of now edge estimation may not be appropriate. These outcomes demonstrate that GC is heterogeneous crosswise over completed voxel sets, recommending that the examination of the utilitarian connection between ROIs should consider the relationship of all the voxels inside the ROIs. A way to deal with the issue of heterogeneous down-to-earth cooperation between ROIs is to enroll the dissipating of GC respects utilizing a bivariate AR appear for each pairwise mix of voxels in the ROIs. This pairwise GC approach, trailed by Bressler et al. [24], dodges the conceivable traps of averaging, and likewise makes achievable the differing estimation of GC thickness and quality between ROIs, two factors that are conflated by averaging. Along these lines, inferring system GC estimation between ROIs from the course of GC respects over all voxel-voxel sets might be quantifiably more enlightening than essentially setting it to the GC between completed voxel midpoints. Regardless, there is a further issue, with the pairwise-GC measure: some GC views might be seen as being massive when really, they are certainly not. This issue creates, for instance, on the off chance that one voxel (x) ’drives’ a second voxel (y), while voxel y ’drives’ a third voxel (z), without there being a ’drive’ from voxel x to voxel z. For this condition, the GC from voxel x to voxel z might be misleadingly seen as being essential. In another case, the issue likewise occurs if voxel x ’drives’ both voxels y and z with various deferrals, without there being a ’drive’ from y to z. For this situation, the GC from y to z might be misleadingly perceived as being essential. Since x, y, and z might be in the same or specific ROIs, one point these outlines highlight is that the GC inside ROIs ought to be seen so as to decrease the likelihood of misleadingly seeing GCs as being essential. The second point is that change in the GC figuring might be conceivable by utilizing a methodology that can coordinate the issue of beguiling GC. Figure 5.2 causality. Basic driving cases that can incite fake unmistakable check of huge Granger A) Sequential driving representation, where voxel x drives voxel y, which likewise drives voxel z. GC from x to z might be misleadingly seen as being huge. B) Differentially yielded driving, where voxel x drives voxel y with shorter postponement and z with longer deferral. GC from y to z might be wrongly seen as being essential. EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 163 Our approach to managing the issue of fraudulent GC criticalness lies in the probability of prohibitive GC. There have been remarkable GC examination tests for an essential GC from one-time plan to a second, with the effect of a third-time game plan cleared. By this system, it is possible to choose if a principal GC assessed between two-time diagrams is inferable from the third-time procedure. In this chapter, we utilize the prohibitive GC thought for ROI-level examination in a methodology that on an extremely fundamental level evaluates the GC between any match of voxels in two ROIs subordinate upon the assorted voxels in the ROIs. This is refined by working up a singular multivariate vector autoregressive (MVAR) show from the voxel time strategy, rather than the pairwise-GC method, in which another bivariate AR exhibit is worked for each voxel constellate. Usage of the MVAR indicates the attestation of diminishing or taking out the issue of fundamental compulsion GC seeing assertion in the assessment of supported utilitarian formed undertakings from FMRI BOLD signals. To make use of the MVAR model for ROI-level GC analysis necessitates overcoming one further problem that often occurs in model estimation: the number of available observations (data points) limits the number of parameters (model coefficients) that can accurately be estimated. This problem commonly arises in neurobehavioral studies where the number of data points that can realistically be acquired limits the size of the MVAR model that can be estimated. This limitation can be mitigated, however, if it is assumed that the voxel-voxel functional interactions between ROIs are sparse (i.e., have a low connectivity density). Under the assumption of sparseness (low connectivity density), the least absolute shrinkage and selection operator (LASSO) algorithm is used to pre-select variables for inclusion in the MVAR model, thus overcoming the problem of a limited number of data points. The LASSO algorithm has previously been tested on numerical experiments, gene-network data and simulated and experimental fMRI BOLD data [30, 32]. This section displays a different usage of the MVAR model to consider voxelbased locale-to-zone exchanges in the psyche, particularly long-extend, top-down interregional co-tasks in visuospatial thought. We show that the LASSO check can be adequately used to pre-select model parts, along these lines enamoring estimation of the coefficients of a voxel-based MVAR model of two predefined ROIs. The imaginativeness of our methods is derived from: 1. Estimation of the MVAR show for FMRI voxel-level BOLD time game plan from two ROIs; 2. Usage of the LASSO figuring for variable pre-affirmation before MVAR demonstrate estimation; 3. Use of the General Cross-Validation control for picking perfect markers in the MVAR appear from the LASSO count; and 4. Creating two sorts of summation bits of data at the ROI level that locate the different estimations of thickness and nature of GC between ROIs. We report the conceded results of both MVAR exhibit reenactments and the utilization of MVAR show estimation to an original FMRI BOLD dataset obtained amid 164 NETWORK ROUTING SIMULATION USING MATLAB a visuospatial thought errand. The duplication results which exhibit the voxel-based speculations can in a split second more get the GC between two ROIs than the averaging approach. Decisively, when LASSO is used to pre-select variables for association in the MVAR demonstrate estimation, voxel-based GC rundown estimations are more in touch with coefficient changes in the model than GC regards enlisted from finding within the estimation of signs. Rope pre-decision grants MVAR exhibit estimation to fit the reenacted data successfully as long as the GC sensible transparency is low, i.e., has unassumingly low thickness. We, in like manner, report that difference in the voxel-based GC course of action by match insightful bivariate AR show estimation, as opposed to by MVAR demonstrate estimation with LASSO pre-affirmation, which may yield misleadingly fundamental GC regards. The correct results demonstrate that the vulnerability of insufficient GC critical receptiveness is sensible and that LASSO variable pre-affirmation taken afterwards by MVAR show estimation is likewise profitable for exploratory FMRI BOLD data. In like manner, the low GC accessibility thickness scanned for this dataset recommends that are made were inter-regional objects and even in the heterogeneous format and form an array of information. Furthermore, the directional asymmetry seen, as evaluated by the GC quality synopsis estimation, is dependable with the current hypothesis on top-down change in visuospatial thought. We induce that LASSO variable pre-decision and MVAR show estimation can be sensibly used to check Granger causality between cortical zones from voxel-wise FMRI BOLD signs. Through the MVAR appear, it is profitable to confine all the voxels in a ROI, rather than taking an ordinary over the ROI. Hence, sensibly made interregional exchanges are obtained with less reshaping of the information passed on in the BOLD time outline. 5.1.2 Application to Recreated Information Delight MVAR models were created based on Zt = p Bk Zt−k + Et (5.1) k=1 and iterated to convey reenacted fMRI BOLD time course of action information for pseudo-voxels in two pseudo-ROIs having settled sizes (30 pseudo-voxels in X and 50 pseudo-voxels in Y). The progression technique for the presentation of proliferation was made by iterative emotional testing of a zero-mean global spread with the standard deviation of 0.1. The four coefficient submatrices (Bxx , Byx , Bxy , and Byy ) were amassed openly. For each submatrix, a few coefficients (bij ) were arbitrarily set to zero, and the rest were abstractly drawn from a standard portion with zero-mean and a particular standard deviation (0.1 for Bxy , 0.08 for Bxx and Byy and 0.2 for Byx ). For every pre-occupation, a 200-point-long time blueprint for every pseudo-voxel was made by display cycle. A total of 56 simulation models was made. The density of the model framework was deliberately stretched out with developing model particu- EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 165 lar confirmation number by extending the measure of voxel sets related by non-zero b respects [34, 40]. Table 5.1 The fraction of non-zero coefficients in each of the 4 submatrices. The fraction changed over the models from values of approximately 0.05 to values of approximately 0.29, increasing by approximately 0.04 every 8 models. 166 NETWORK ROUTING SIMULATION USING MATLAB To affirm show authenticity, we checked that the connections of the model residuals were low for each one of the 56 models. A special residuals relationship arranged from one of the representations is shown in Figure 5.3, demonstrating discretionarily scattered frail association across over-repeated voxel sets. We saw the models as significant in perspective of these discernments. Figure 5.3 Granger causality patterns between simulated ROIs. We then considered the effect of averaging the BOLD activity of all voxels in a ROI on the estimation of interregional GC. The GC between two ROIs, each one of which is addressed by a touched base at the midpoint of time game plan, was assessed by a lone t-score toward each way. For it to accurately delineate the system between ROIs, the t-score was required to take after the distinction in parameters over the representations models showed up. We attempted this desire by assessing the relationship of the t-scores from the touched base at the midpoint of the time course of action with two framework estimations (the piece of tremendous affiliations, f, and the ordinary system quality, W). These diagram estimations were prepared particularly from the generation models, and in this way took after the distinction in parameters over the reenactment models. The t-scores obtained from found the center estimation of time plan were not associated (p < 0.05) with either summation estimation. That the t-scores did not take after the distinction in parameters across over-proliferation models demonstrates that enrolling GC from found the center estimation of the voxel time course of action does not get between ROI arrange plans. GC was figured from found the inside estimation of voxel time approach as tyx and txy , and from there on organized to z-scores, for a degree of redirection models (top fragment). Moreover, GC was arranged as voxel-based W (center segment) and f (benchmark) rundown estimations enrolled primarily from the parameters of practically identical engendering models (b respects systematized to z-scores before figuring W). The level focus point means the 56 reenactment models of interest in EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 167 Table 5.1, tend to various framework parameter settings. The t-scores don’t in a general sense relate with either W or f crosswise over completed increase models, demonstrating that GC figured from met up at the midpoint of voxel time approach isn’t sensitive to genuine openness. Figure 5.4 Comparison of model estimation by LASSO-GC and pairwise GC. We next researched how well voxel-based methodology recuperated the authentic GC instances of the four submatrices over the age models shown. The examination for every representations show first contained an assessment of the full B framework from the reproduced information made by that model utilizing two strategies: (1) pair-wise-GC estimation; and (2) LASSO-GC estimation, i.e., Tie pre-choice of components for participating in a MVAR appear, trailed by GC estimation from the model. The consequence of every framework was separated along with the true-blue qualities in the model. Every last one of these two techniques is voxel-based. 168 NETWORK ROUTING SIMULATION USING MATLAB The pairwise-GC methodology develops the B organize by studying other bivariate AR displays for each voxel join, while the LASSO-GC strategy enlists the B structure by surveying a MVAR show whose parts are pre-chosen by LASSO. Not in the smallest degree, like the methodology of averaging transversely completed voxels, the two techniques process a t-score for every b coefficient in the B organized, testing whether the estimation of that coefficient in a general sense veers off from zero. The enormous non-zero b respect is comparable to an essential GC respect when the model interest is one. The images shown in Figure 5.5 and Figure 5.6 address the outcomes from an engendering in which the LASSO-GC procedure enthusiastically evaluated the instance of b estimations of the model, while the pairwise-GC framework yielded an expansive number of false non-zero qualities. The X voxels in A-C are represented by green dots and Y voxels by red contacts. All the t and b respects are z-organized. A. Simulated framework instance of the model for the four B cross-segments, with orange shocks tending to positive b respects and blue jars contrary to b respects. B. Estimated openness plot with the LASSO-GC system. Massive t-scores are shown as jars, with the thickness tending to the transcendent size of the t-scores, and the shading tending to the indication of the t-score (orange for positive, blue for negative). The representation looks like that in the model. C. Estimated availability layout with the pairwise-GC method, appeared in an indistinct way for the LASSO-GC result. The openness is essentially denser than the model case. D. Summary estimations f and W for the representations were shown in the past three sheets. Rope GC respects organize the model attributes more enthusiastically than do pairwise-GC respects. To choose how ordinary the outcomes seen in underneath figure overall reenactment models, theoretical bits of learning from pair-wise-GC and LASSO-GC estimations were separated and those selected directly from the models. First to be utilized was the f plot estimation, which evaluates the portion of fundamental b respects. Underneath picture thinks about how well the pair-wise-GC and LASSO-GC philosophies recuperated the valid f rundown estimation enlisted especially from the increase models. It uncovers that in various reenactments the f rundown estimation from pair-wise-GC estimation was more evident than the bona fide entertainment indicate respect; anyway that from LASSO-GC estimation positively arranged the certified engendering display respect. We depicted the separation among overviewed and indicate f respects by their total separation and considered the divisions working out as expected under the LASSO-GC system with that from the pair-wise-GC procedure. Composed t-tests showed exceedingly on an essential level (p < 0.01) more small segments with the LASSO-GC system for every last one of the four submatrices. EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 169 The piece of massive b coefficients (f summation estimation) in each submatrix, selected directly from the reenactment outline, is separated and the f estimation reviewed by the LASSO-GC and pairwise-GC procedures. The evaluated LASSO-GC f estimation more nearly sorts out the f estimation of the model crosswise over completed reenactment models than does the studied pair-wise-GC f estimation. The even turn is created by the indistinct path in Figure 5.2. The case shown in Figure 5.5 is from the 28th model. Figure 5.5 Correlation of LASSO-GC and pairwise-GC techniques in recouping the summary measurement. The W general estimation, which mirrors the standard idea of essential GC from voxels in one ROI to voxels in another, utilized adjacent separate pairwise-GC and LASSO systems. Additionally, with the f estimation, the W estimation from the LASSO framework encouraged the authentic W estimation enrolled from the entertainment demonstrate more excitedly than that from the pairwise-GC technique (Figure 5.6). Likewise, compared with the f estimation, the packets among reviewed and exhibited W respects for the two techniques were looked at. Composed t-tests indicated essentially (p < 0.01) more modest segments with the LASSO-GC system for each one of the four submatrices. The GC quality (W unique estimation) in each submatrix, figured straightforwardly from the age delineate, is separated and the W estimation studied by the LASSO-GC and pairwise-GC frameworks. The representation on LASSO-GC W estimate only the increment related to the model based on the previous models and the finished model representations and those are evaluated using pairwise-GC W. Since the surveyed W estimation depends upon t-scores and the show of proliferation, W estimation enrolled primarily, which depends upon b coefficient respects, both b and t-scores were systematized to standard z-scores before figuring W. 170 NETWORK ROUTING SIMULATION USING MATLAB Figure 5.6 Correlation of LASSO-GC and pairwise-GC techniques in recuperating the W summary measurement. The relationship of LASSO-GC versus pairwise-GC crosswise over more than 56 runs can be considered as 56 rehashed fundamental of the two methods for their effectiveness in evaluating model parameters. How that LASSO-GC yielded more correct estimations than pairwise-GC over a degree of various parameter settings indicates LASSO-GC’s ability. To likewise underwrite this end, we repeated each 56-run test on 20 disengage emphases, each cycle utilizing a wholeheartedly made dataset with the parameters. The ensuing GC diagrams over the 20 cycles are tried and true. To design the outcomes up until this point, the LASSO-GC technique was found to beat the pairwise-GC philosophy and the standard matter-based system in recouping reenactment indicate availability. We next related the LASSO-GC framework to analyze availability in an observational FMRI BOLD dataset. 5.1.3 Application to FMRI BOLD Information from a Visuospatial Consideration Undertaking An FMRI BOLD dataset from a next occasion related visuospatial thought errand point of view was taken down with the LASSO-GC strategy. Bits of learning about the test format and the FMRI recording are open. Inside every last one of 6 subjects, measure up to zones V1v, V2v, VP, V3A and V4 were in the visual occipital cortex (VOC), and separate spaces frontal eye field (FEF) and front and back intraparietal sulcus (aIPS and pIPS) were in the dorsal attention network (DAN). Regarding MVAR models of interest, one were evaluated from the time game plan of all voxels from each join of VOC and DAN ROIs by the LASSO-GC strategy. The best MVAR demonstrate contained around 150 voxels. Rehashed starters (run of the mill number ≈ 70) at each time point were utilized as observations [30]. EVALUATION OF GRANGER CAUSALITY MEASURES ON KNOWN SYSTEMS 171 The inevitable results of practical framework examination between the VOC and DAN are introduced for a master ROI participate in one subject. The four systems address GC mastermind inside right V P (V P → V P ), from right FEF to right V P (F EF → V P ), from right VP to right FEF (V P → F EF ), and inside right (F EF → F EF ). GC openness is deficient both inside and between ROIs, recommending that a flat section of t-scores is tremendous at p < 0.05 (fV P →V P = 0.08, fF EF →V P = 0.04, fV P →F EF = 0.06, fF EF →F EF = 0.03). Both absolute positive (orange shocks) and inherently harmful (blue jars) GCs are available both inside and between ROIs. A positive GC exhibit that broadened action of the “sending” voxel predicts expanded action of the “getting” voxel; anyway, a negative GC implies that expanded improvement of the “sending” voxel predicts the diminished movement of the “receiving” voxel. Figure 5.7 Examination of network designs with LASSO-GC and connection measures. In Figure 5.7, cases are shown for one fantastic ROI to organize from one subject. The t-scores from LASSO-GC examination were z-systematized. Green contacts address voxels from right VP and red spots address voxels from right FEF. A. Estimated availability diagrams with the LASSO-GC measure. B. Estimated sort out diagrams with the affiliation measure. Necessary crossrelationship coefficients are shown as lines, with the thickness tending to the all-around degree and the shading tending to the sign (orange for positive, blue for negative). C. Summary estimations for the cases appeared in the past two sheets. For the relationship measure, F EF → V P and V P → F EF have an equivalent design score since the measure is non-directional. 172 NETWORK ROUTING SIMULATION USING MATLAB Framework in the context of the affiliation measure is also considered. For associations assessed obviously on the FMRI BOLD time plan, a more noteworthy bit of affiliations is enormous at p < 0.05 (fV P −V P = 0.67, fV P −F EF = 0.30, fF EF −F EF = 0.45) for equivalent ROI join and subject, recommending that a large piece of the voxels are connected. More deficient availability from LASSO-GC than from affiliations is undoubtedly found in the f and W summation bits of information. This is more inadequate with regards to openness found with LASSO-GC than with a relationship which may have been a significant impact of LASSO re-affirmation. Regardless, this was thought not to be the condition since the associations still indicated stunningly more numerous cases than the LASSO-GC results despite being arranged after LASSO pre-confirmation. That the ordinary relationship openness quality is more evident than 2, both inside and between ROIs, shows that each voxel gets, everything considered, relationship from more than two particular voxels. This impression of respectably long relationship thickness confirms that the LASSO-GC system is required to lessen affiliation instigated beguiling GC measures. To stretch out the practical openness examination to the full FMRI BOLD dataset, we related the LASSO-GC framework to every single one of the 60 VOC-DAN ROI participates in every last one of the six subjects. The f and W summary estimations were then found to be the inside estimation of crosswise over completed ROI unites and subjects, yielding mean f and W layout bits of information for VOCto-VOC compose, DAN-to-DAN availability, DAN-to-VOC openness, and VOC-toDAN availability. This four openness makes diverge from the four coefficient sub-networks of the evaluated B cross area in LASSO-GC examination: VOC-to-VOC and DAN-to-DAN organized model propose to sort out inside a particular domain of VOC or DAN, not to compose between various VOC or DAN districts. The mean f plot estimation is underneath 0.1 for all sub-cross sections, explains the information lagging related to the implementation of the ROI GC. The f and W rundown estimations were enlisted from LASSO-GC for every single one of 60 ROI sets and six subjects, and after that found the middle estimation of over sets and subjects. For every rouse facilitate, one ROI was in the dorsal attention network (DAN), and the other was in the visual occipital cortex (VOC). The bars address mean f and W graph bits of information for VOC-to-VOC sort out, DANto-DAN openness, DAN-to-VOC framework, and VOC-to-DAN availability. Stumble bars address the standard spoil of the mean. Fundamental contrasts from facilitated case t-tests are checked (∗ : p < 0.05). United outline t-tests with subjects as rehashed measures (df = 5 for all associations) were performed on both f and W to consider: (1) top-down (DAN-to-VOC) with base up (VOC-to-DAN) openness; (2) inside VOC with inside DAN mastermind; (3) top-down with inside VOC framework; and (4) base up with inside DAN availability. DEMAND MODELING AND PERFORMANCE MEASUREMENT 173 Figure 5.8 Utilitarian availability examination of dorsal attention network and visual occipital cortex in visual-spatial consideration. The examination of best down with inside DAN availability and the association of base up with inside VOC sort out were not performed in light of how these connections are crude, i.e., they depend upon GC to voxels in a sending district; anyway, the W layout estimation depends upon voxels in a getting territory. The outcomes show that inside VOC (V OC → V OC) organized was all things considered more essential than top-down (DAN → V OC) availability for both the f (t = 4.60, p < 0.05) and W (t = 2.85, p < 0.05) rundown estimations, exhibiting that the zone GC between voxels inside VOC is both thicker and more grounded than the long-extend, top-down GC from the DAN. Framework inside DAN (DAN → DAN ) was also on an extremely essential level more prominent than that in the base up heading (VOC-to-DAN) for the W rundown estimation (t = 4.07, p < 0.05); at any rate not for the f plot estimation, displaying that the territory GC between voxels inside DAN is more grounded, yet not merely more thick, than the long-extend GC from VOC. At last, openness the best down way (DAN → V OC) was all things considered more evident than that in the base up course (V OC → DAN ) for the W rundown estimation (t = 3.93, p < 0.05) yet not for the f format estimation, showing a long-extend directional quality asymmetry among DAN and VOC, with more grounded top-down framework. 5.2 5.2.1 Demand Modeling and Performance Measurement Objectives This section presents a rundown of an undertaking that created distinctive potential models of assessment and execution estimation works inside government small offices. The objective of the task was to investigate what kinds of models would be most proper given the different qualities, needs, and assets accessible inside small offices. The venture was not intended to create a “how to” execution toolbox for small organizations in creating assessment and execution estimation capacities. Alterna- 174 NETWORK ROUTING SIMULATION USING MATLAB tively, maybe, the motivation behind the venture was to create models that would manage any usage work that was to be taken on afterwards. Without a doubt, a toolbox or execution help might be fitting subsequent stages in light of the models created for the present venture. 5.2.2 Approach to Model Development The present task considered both the assorted variety of the government small office network and also the distinctions and one of the difficulties that small offices experience in comparison with medium-sized and extensive offices. The model advancement was directed in two stages with the underlying stage including information gathering (key source interviews, contextual analyses, a writing audit, and a survey of methodologies in different wards). The second stage included endorsing the draft models with the small office organize through a self-assessment, and opening examination work out. An outline of findings from Phase One - Data Collection follows. The critical discoveries from the key witness interviews, contextual analyses, writing audit and survey of other wards’ methodologies were isolated into two primary regions: 1. Characteristics of the small organization network that should be comprehended and considered while talking about potential models of assessment and execution estimation; and 2. Current methodologies and practices intended to assess and execute estimation in small organizations. About community characteristics, the main findings are as follows: There is a noteworthy assorted variety in organization measure, which is associated with the sum and sorts of data expected to settle on choices and provide details regarding exercises. The capacity to impact moves in the office to culture (towards one of resultsbased estimation) changes inconceivably between associations. For small workplaces, frequently the political agent (the Head of the association) does not so much incorporate contribution inside the overall public advantage. One test this may cause in a couple of associations is that there is a nonattendance of assistance or cognizance from the Head of the workplace as to issues of execution uncovering and appraisal inside an open organization setting. Resource obstructions of small workplaces are noteworthy. There is no versatility in their assignment of benefits for the progression of new internal systems that are not particularly part of their arranged business line. As for human resource examinations, there is an inconvenience in pulling in an internal breaking point, even where positions exist. DEMAND MODELING AND PERFORMANCE MEASUREMENT 175 There are the most fundamental things which are related to the current methodologies of the operation. There is much variety inside the small organization network as to how exceptional offices are in the zones of execution estimation and assessment. Agencies that had built up the best limit concerning execution estimation and assessment regularly had an identifiable “champion” in the office that comprehended and worked reliably at clarifying the advantages of execution estimation and assessment to different individuals from the association. Most offices distinguished senior administration supporter as being essential to create the global social movements required in an association as it incorporates the ideas and procedures of execution estimation and assessment inside the daily exercises of the association. 5.2.3 Development of Models The discoveries from Phase One added to the improvement of three unique models of ways to deal with assessment and execution estimation in small offices. The decision of which model would be most appropriate for a specific organization depends on the responses to two necessary inquiries that frame the basis for assessment and execution estimation: What sorts of essential leadership must chief executives in offices perform? What sorts of data do they have to settle on those choices? A few kinds of essential leadership may require extremely complex data, while another essential leadership requires moderately direct data. The three models depend on the level of the multifaceted nature of data required from the assessment and execution estimation exercises inside an association (direct, mixed, and complex). Assurance of data needs depended on some ordinary qualities, for example, number of business lines, level of hazard related with choices, number and kinds of partners, consistency of workload, office estimate, nature of enactment related with office, extent of spending plan dispensed to awards and commitments, number of workplaces, and the adjustment of accentuation on the process and also the effects of the organization. There are three main components from each of these three models, namely: The rationale for the assessment and execution estimation work because of data needs; Design and delivery of the assessment and execution estimation work inside a specific organization, for example, assessment arranging, pointer improvement, inner limit versus the utilization of outer assets for execution estimation, and joining of the capacity’s exercises with other administration exercises; and, 176 NETWORK ROUTING SIMULATION USING MATLAB Outcomes of the assessment and execution estimation work, for example, recurrence of-appraisal questions, recurrence of interior announcing and mix with arranging, joining of exercises with outside revealing, and utilizing data to help necessary leadership. 5.2.4 Outline of Findings from Phase Two: Model Validation The objective of Phase Two was to affirm the models inside the small office arrangement. The large number of people who partook in the endorsement refinement showed that they had a blend of both respectably coordinate information needs to be joined with several points that may have required more specific or intricate information. Input obtained from the respondents concerning the models was sure, with the vast majority of respondents demonstrating that the models were proper for both their particular office and the small organization network all in all. One remark that was received from various offices was that the models were a sensible beginning, yet the activity did not show the following stages to improve holes or to actualize the exercises portrayed in the models. As already noted, this was not inside the scope of the present venture. Nonetheless, it is a decent sign that the following stage in this procedure is to help small organizations in the execution procedure. This section shows a synopsis of a task that created distinctive models of how issues of responsibility and execution estimation could be attended to among the diverse sorts of small government organizations. The present task considered both the assorted variety of the government small organization networks and also the distinctions and extraordinary difficulties that small offices experience in correlation with medium-sized and extensive offices. The venture was intended to address the cutting-edge comptrollership region of creating, reinforcing and actualizing better responsibility systems among small organizations by fortifying the assessment and execution estimation works in small offices. Most small offices are liable to the Treasury Board Evaluation Policy; however, many do not have work assessment or a huge ability to create and lead execution estimation exercises. It is foreseen that suitably estimated assessment work, as well as execution estimation ability in small offices, will add to a situation that will build responsibility through enhanced detailing of results accomplished for different arrangements, projects or activities. Also, quality data on results accomplished will aid the necessary leadership process among supervisors. The small office network in the national government is to a high degree diverse with regards to such measurements as authoritative structure, association with more prominent offices, nature of work, and association estimate. These measurements, notwithstanding others, add to the sort and nature of data that offices require for basic leadership and guaranteeing responsibility. Small workplaces in like manner have incredible challenges and traits when differentiated from medium-sized or immense government divisions. One differentiation is that small associations every now and again have two or three business lines in relationship with medium- and generous-sized workplaces that frequently have DEMAND MODELING AND PERFORMANCE MEASUREMENT 177 diverse business lines containing various activities. Another refinement is that, when examined against workplaces, small associations consistently have more limited versatility in cash-related resources. The refinements, models of meeting duty and execution essentials in medium-sized and immense divisions may not be as relevant to small associations. The wander gathers used a two-stage organization approach for the endeavor. The primary stage included vital witness interviews, relevant examinations, and a review of strategies used for keeping an eye on obligation and execution estimation necessities in various districts. Using the information accumulated from these sources, the wander bunch made draft models of how various types of small workplaces could address obligation and execution estimation necessities. The inspiration driving the key witness gatherings and relevant examinations was to assemble information that would help the change of the draft models keep an eye on obligation and execution estimation essentials in small associations. For subtle elements on the members in key witness interviews and the contextual investigations, information gathering instruments, and brief descriptions of the 15 singular contextual investigations are utilized. Figure 5.9 Different phases of approach in attributes. The sort of data that was gathered amid these exercises was of two primary compositions: Community characteristics: These incorporated the recognizable proof of particular attributes of the small organization network. This was a critical kind of data to gather given that the general motivation behind the venture was to create models that would be proper for the network, and not only adjustments of models utilized by expansive or medium-sized divisions. A few attributes that were 178 NETWORK ROUTING SIMULATION USING MATLAB viewed included data needs, authoritative structure, organization orders, office measure, adaptability in assets, current difficulties, and enactment prerequisites. Current approaches to addressing accountability and performance measurement requirements: This sort of data was especially helpful in distinguishing any prescribed procedures or exercises learned about how the offices participating think and also any holes or zones that were especially testing to address. This data was explicitly utilized in the improvement procedure to guarantee that the models caught the methodologies that had been effectively utilized in a few organizations and that they tended to the holes distinguished in a few offices. 5.3 Universal Algorithms and Sequential Algorithms A widespread calculation for continuous information pressure is introduced. Its execution is researched concerning a non-probabilistic model of compelled sources. The pressure proportion accomplished by the proposed all-inclusive code consistently approaches the lower limits on the pressure proportions achievable by obstructto-variable codes and variable-to-square codes intended to coordinate an indicated source. There are a few clarifications which manage the execution of the Universal calculation in genomic consider and furthermore an individual examination on numerical calculations identified with the information pressure. We will certainly think about both of these areas. 5.3.1 Genetic Algorithm for Improvement Utilizing MATLAB As the employment of structures extend to various parts of our moment-by-moment lives, it updates the complexity of systems in software design (program response as shown by condition) and gear fragments (stores, branch foreseeing pipelines). Throughout the years, test engineers have developed another testing technique for testing the rightness of systems: to be precise, the transformative test. The test is deciphered as an issue of headway and uses formative count to find the test data with exceptional execution times. Formative testing connotes the use of transformative estimations. Since formative counts are heuristics, and their execution and yield adequacy can change over multiple runs, there is a strong need for a method that can handle these complexities; consequently, MATLAB is now being extensively used every day. This territory explores the potential power of Genetic Algorithm for development by using new MATLAB-based execution of Rastrigin’s capacity; all through this section we utilize this breaking point as streamlining issue to illuminate some critical implications of inherited change like decision half and half and change. Acquired tallies are a way to deal with overseeing change and learning growth straightforwardly in light of checks of fundamental change; these are not hard to fabricate, and their utilization does not require an impressive proportion of point of confinement, settling on them an adequate decision for a movement issue. Coming UNIVERSAL ALGORITHMS AND SEQUENTIAL ALGORITHMS 179 full circle, getting sorted out is a nonlinear issue that can’t be settled successfully yet; a GA could serve to find a not very unpleasant procedure in an agreed upon degree of time. Genetic counts are prompted by Darwin’s speculation about the development “survival of fittest”; it glances through the approach space of a most extreme utilizing reproduced movement structure. Overall, the fittest individuals of any masses have increasingly immense chance to copy and have the chances to motivate and change the approach of implementation with the unique manner. However, underneath conventional individuals can by chance endure and also impersonate. Genetic estimations have been seen to oversee straight and nonlinear issues by taking a look at all districts of the state space and exponentially abusing promising regions utilizing change, half and half and affirmation exercises to individuals in the all inclusive community. The movement of new programming advancement and the new programming conditions (e.g., MATLAB) provide a stage for managing troublesome issues consistently. It encourages numerical examination, network figuring and diagrams in an easily used manner. MATLAB (Matrix Laboratory), an offshoot of MathWorks, is a savvy programming bundle created to give a merged region to numeric include and diagrams depiction sporadic state programming tongue. It was first created by Dr. Cleve Moler, chief mathematician, chairman, and cofounder of MathWorks, to give unobstructed access to cross area programming made in the LINPACK and EISPACK meanders. MATLAB has an ample accumulation of limits definite to the acquired tally ace and those wishing to explore particular avenues for the hereditary figuring out of the blue. In MATLAB’s unpredictable state vernacular, issues can be coded in m-records in a shorter amount of time than it would take to make C or FORTRAN programs for a relative reason. It also gives actuated information examination, acknowledgment gadgets, and extraordinary reason application district instrument compartments [44, 45, 49]. The execution of hereditary estimation on tip-top PCs is a troublesome and dismal errand. The finishing vernaculars must be about as conceivable to the numerical description of the issue, basic and straightforward to utilize procedural tongue. The C/C++, FORTRAN, which chops down level amassed programming vernaculars that is widely utilized in the scholastic system, industry, trade, and GA, is also finished by utilizing these classes of dialects. The high rule position of sorted out low-level languages is their execution speed and gainfulness (for instance installed systems). Nowadays MATLAB is consistently utilized in research and industry, and is a case of a strange state “scripting” or “fourth-period” tongue. This declines the execution speed, yet makes the designer free from memory association, gifts dynamic making and keen sessions. Note that the endeavors sent in scripting dialects are usually ultimately shorter than relative assignments written in gathered vernaculars and also necessarily set aside less opportunity to code and examine. Like this, there is an exchange between the execution time (little for collected languages) and the change time (little for deciphered vernaculars). Another essential fragment of MATLAB (and other deciphered vernaculars like Python) is the capacity to have brilliant sessions. The solicitations which are requested by the clients which are unwanted can be excluded or in the modelling, we can exclude those which are useless scripts in the part of code. 180 NETWORK ROUTING SIMULATION USING MATLAB The fundamental thing that must be done to recall a definitive target to utilize a GA is to choose if it is conceivable to store up game plans on the issue in this way. It is a must to do that in light of how a GA requires an essential people P of blueprints; the twofold being the most generally utilized since they are the most adaptable. In the wake of picking the quality description it must choose the framework to pick guards from the majority P (cost roulette wheel, stochastic universal sampling, rank roulette wheel, tournament selection, and so forth.), the manner by which these guards will “mate” to make relatives, the change approach (discretionary at any rate pleasing), the procedure that will be used to populate the all-inclusive community to come and the figuring’s end condition (number of ages, time restrict, agreeable quality purpose of captivity). The second thing that must be done is to set up Processor and working framework; for running the program the estimation is coded in MATLAB. MATLAB gives a change instrument stash that joins a GA-based solver. The tool kit can be activated by entering optic tool in the MATLAB’s ask for line and pressing enter. Right, when the streamlining window shows up, we can pick the solver genetic algorithm (GA) and now MATLAB is set to go. The client should program (by making m records) any extended accommodation required [45, 50]. Figure 5.10 GAs in MATLAB’s Optimization Toolbox. By using any Optimization Toolbox solver except intlinprog, and any Global Optimization Toolbox solver except GlobalSearch and MultiStart, results can be exported to a file or to the MATLAB workspace as a structure. UNIVERSAL ALGORITHMS AND SEQUENTIAL ALGORITHMS 181 optimtool(optstruct) starts the Optimization app and loads optstruct. optstruct can be either optimization options or an optimization problem structure. Create optimization options with the optimoptions or optimset function, or by using the export option from the optimization app. Create a problem structure by exporting the problem from the optimization app to the MATLAB workspace. If you have Global Optimization Toolbox, you can create a problem structure for fmincon, fminunc, lsqnonlin, or lsqcurvefit using the createOptimProblem function. optimtool(’solver’) starts the Optimization app with the specified solver, identified as a character vector, and the corresponding default options and problem fields. All optimization toolbox and global optimization toolbox solvers are valid inputs to the optimtool function, except for intlinprog, GlobalSearch, and MultiStart. The condition of this point of confinement and MATLAB (m-document) code is given as, (5.2) Ras(x) = 20 + x21 + x22 − 10(cos2πx1 + cos2πx2 ) MATLAB Code: 1 2 3 4 5 6 7 8 function y = cast(x) % the default value of n = 2. n = 2; s = 0; for j = 1:n s = s+(x(j)ˆ2-10*cos(2*pi*x(j))); end y = 10*n+s; Press the Start to get. The calculation begins, the plots pop up, and soon the outcomes appear, as shown in Figure 5.11. Figure 5.11 Rastrigin’s function optimization with the default setting. 182 NETWORK ROUTING SIMULATION USING MATLAB The most successful work (the simplest is kept) and the end condition met are printed, together with the game plan (Final Point is near (0.0)). Since the technique is stochastic, there isn’t any desire to be able to recreate any outcome found in a substitute run. Eventually, check the two plots on the left. Doubtlessly, the majority joins since the standard segment between people (plans) in term of the prosperity respect is reduced, as the ages pass. This is a degree of the different collection of masses. It is difficult to keep up an essential partition from affiliation; in any case keeping it low or putting off its appearance is better. 5.3.2 Masses Diversity-Measure-Run, Prosperity Scaling The traditional variety of central individuals influences the execution of a GA. In the event that the run of the mill separation between people is expansive, it is a sign of high superior to typical variety; the game plan differs based on the customary division in the working area. If the flexible grouping is too high or too low, the acquired tally likely will not perform well. We will enlighten this by the running with: By default, the Optimization Tool makes optional starting individuals utilizing a creative work. We can keep this by setting the Initial range field in Population choices. Set it to (1; 1.1). Leave the rest of the settings as before (Figure 5.10) aside from Options-Stopping Criteria-Stall Generations, which ought to be set to 100. This will permit the figuring to keep running for 100 ages, giving us better outcomes (and plots). Before long tap the Start gets [41, 42]. The GA restores the best wellbeing work estimation of around 2 and displays the plots as in Figure 5.12. Figure 5.12 Rastrigin’s function optimization with the default setting, except Stopping Criteria-Stall Generations set 100 and initial range set [1; 1.1]. The upper plot, which shows the best wellbeing at each age, displays little progress in chopping down the prosperity respect (diminish bits). The lower plot demonstrates the common segment between people at each age, which is a reasonable degree of UNIVERSAL ALGORITHMS AND SEQUENTIAL ALGORITHMS 183 the different arrangement of people. For this setting of beginning extent, there is an excessively insignificant customary arrangement for the figuring to gain ground. Next, set Initial range to [1; 100] and run the tally once more. The GA restores the best wellbeing estimation of around 3.3 and exhibits the running with plots as in Figure 5.13. Figure 5.13 Rastrigin’s function optimization with the default setting, except Stopping Criteria-Stall Generations set 100 and initial range set [1; 1.1]. This time, the hereditary tally gains ground, yet since the standard division between people is so vast, the best people are a long way from the ideal game plan. Note that in any case if we let the GA keep running for more ages (by setting Generations and Stall Ages in Stopping Criteria to 200), it will locate an ordinary course of action. Set Initial range to [1; 2] and run the GA. This advantages the best prosperity estimation of around 0.012 and exhibits the plots that take after, as in Figure 5.14. Figure 5.14 Rastrigin’s function optimization with the default setting, except Stopping Criteria-Stall Generations set 100 and initial range set [1; 2]. 184 NETWORK ROUTING SIMULATION USING MATLAB The bearable combination for this situation possesses all the necessary qualities of the issue, so the hereditary figuring restores an inconceivably upgraded outcome compared to the past two cases. In every last one of the cases above, we had the Population Size (Options-Population) set to 20 (the default). Note that Population Size to be in any event the estimation of Number of parts, with the target being the all-inclusive community in every space being looked at. Lastly, another parameter that affects the different combinations of the majority is Fitness Scaling, on the off chance that the thriving also regards influence for the most part. As shown in Figure 5.15, the all-inclusive community with the most diminished qualities (a review that we limit) replicates too quickly, expecting expert over the majority pool too rapidly and protecting the GA from searching for changed areas of the strategy space. Figure 5.15 Lower raw fitness value. The upper plot, which demonstrates the best prosperity at each age, shows little advancement in hacking down the success regard (decrease bits). The lower plot shows the average package between individuals at each age, which is a practical level of the various accumulation of people. For this setting of beginning degree, there is an exorbitantly unimportant standard game plan for the figuring to make strides. Next, set Initial range to [1; 100] and run the check afresh. The GA reestablishes the best prosperity estimation of around 3.3 and demonstrates the running with plots as in Figure 5.15. This time, the innate count makes progress, yet since the first division between individuals is so far-reaching, the best individuals are far from the perfect course of action. Note at any rate that if we let the GA continue running for more ages (by setting Generations and Stall Ages in Stopping Criteria to 200), it will find a prevalent game plan. Set Initial range to [1; 2] and run the GA. This focal point is the best flourishing estimation of around 0.012 and demonstrates the plots that take after, as in Figure 5.16. UNIVERSAL ALGORITHMS AND SEQUENTIAL ALGORITHMS Figure 5.16 185 Higher raw fitness value. The middle of the road game plan for this condition had all the fundamental qualities to the issue, so the innate figuring reestablishes more unimaginably updated results than in the previous two cases. In every one of the cases above, we had the Population Size (Options-Population) set to 20 (the default). Note that Population Size to be on any occasion the estimation of Number of parts, with the objective that the wide open in each goes to the space bing looked at. Finally, another parameter that impacts the different plan of the more significant part is the Fitness Scaling. In case the flourishing also flounders, as noted in Figure 5.17, the comprehensive network with the most decreased characteristics (a survey that we restrict) copies too rapidly, expecting master over the more significant part pool too quickly and shielding the GA from hunting down changed regions of the game plan space. Figure 5.17 Stochastic uniform selection method. For instance, expect masses of 4 people with scaled qualities 7, 4, 3 and 1. The person with the scaled estimation of 7 is the best and ought to contribute their qualities more than the rest. We make a line of length 1+3+4+7 = 15. Straightforwardly, expect that we have to pick six people for guards. 186 NETWORK ROUTING SIMULATION USING MATLAB We advance over this line in attempts of 15/6 and select the person. The Reproduction board in Option controls how the GA makes the all-inclusive community to come. Here you demonstrate the extent of elitism and the bit of the number of tenants in the front line that is made through mating (the rest is conveyed by change). The choices are Elite Count: the measure of people with the best prosperity respects in the present age that are ensured to make due to the overall public to come. These people are called tip-top youths. The default estimation of Elite check is 2. Attempt to deal with the Rastrigin’s stress by changing just this parameter. The attempted estimations are 10, 3 and 1. We will get results like those portrayed in Figure 5.18. You should keep this respect low, 1 or 2 (subordinate upon the majority measures). Figure 5.18 Elite count 10. Figure 5.19 Elite count 3. UNIVERSAL ALGORITHMS AND SEQUENTIAL ALGORITHMS Figure 5.20 187 Elite count 1. From the Figures 5.18, 5.19, and 5.20 it is clear that a considerable amount of elitism results in early blending, which can make the intrigue less persuading. Crossover Fraction: This is a few people in the all-inclusive community to come, other than five-star kids that are made by blending (remaining is rolled out by improvement). A crossbreed division of ’1’ shows surmises that all youngsters other than five-star people are blend kids. A blend division of ’0’ exhibits that all youngsters are changing teenagers. Two-point Crossbreed: Two cream focuses are chosen, parallel string from the earliest starting point phase of the chromosome to the essential hybrid point is replicated from the central parent, the part from the first to the second blend point is imitated from the other parent, and the rest are duplicated from the guideline parent once more. Mutation: This is the Random change not shy of one digit in the string keeping an eye on a man. Permits set aside an opportunity to investigate the consecutive information practices utilizing MATLAB. 1 Model = sequential (fun, X, y) Choose a subset of highlights from the information to organize X that best foresees the information in y by progressively picking highlights until there is no modification in want. Lines of X relate to perceptions; segments stand out from factors or highlights. Y is a part vector of reaction respects or class names for every acknowledgment in X. X and y must have a practically identical number of areas. Fun is a restrict handle to the furthest reaches that portrays the perspective used to pick constellates and to choose when to stop. The yield model is an anticipated vector demonstrating which highlights are at long last chosen. 188 NETWORK ROUTING SIMULATION USING MATLAB Beginning from a vacant summary of limits, sequential makes sure of part subsets by progressively including every last one of the highlights not yet chosen. For every contender that includes a subset, sequential fs performs 10 relative folding especially in fabric skins which navigate and again with various arranging subsets of X and y, XTRAIN and YTRAIN, and test subsets of X and y, XTEST and YTEST, as takes after: 1 oversee = fun(XTRAIN, ytrain, XTEST, ytest) XTRAIN and YTRAIN contains a tantamount subset of lines of X and Y. Here XTEST and YTEST contain subsets of areas. XTRAIN and XTEST contain the information taken from the pieces of X that appear differently about the present competitor include set. Each time it is called, fun must restore a scalar respect foundation. Frequently, fun uses XTRAIN and YTRAIN to plan or fit a model, then predicts regards for XTEST utilizes that model, and eventually restores some degree of separation, or catastrophe, of those anticipated qualities from YTEST. In the cross-underwriting figuring for a given competitor include set, successively holds the traits returned by fun and packets that entire by the total number of test affirmations. Usual hardship gauges join aggregate of squared errors for fall away from the faith models (sequential fs registers the mean-squared mistake for this situation), and the measure of misclassified observations for organized models (the following figures the misclassification rate for this condition). 1 2 3 4 5 The Below is the syntax we have to consider Inmodel=sequentialfs(fun,X,y) Inmodel=sequentialfs(fun,X,Y,Z,) [inmodel,history]=sequentialfs(fun,X,) []=sequentialfs(,param1,val1,param2,val2,) In the wake of enlisting the mean model’s characteristics for each candidate feature subset, sequential fs pick the contender incorporate subset that restrains the mean worldview regard. This system continues until the point when the moment that including more features does not decrease the run the show. 1 inmodel = sequentialfs(fun, X, Y, Z,...) Permits any number of data factors X, Y, Z, .... sequentialfs picks highlights (regions) just from X, yet all around powers no translation on X, Y, Z,... All information inputs, paying little attention to whether they are portion vectors or structures, must have a practically identical number of lines. sequentialfs calls fun with preparing and test subsets of X, Y, Z, ... as takes after: 1 foundation = fun(XTRAIN,YTRAIN,ZTRAIN,..., XTEST,YTEST,ZTEST,...) Sequentialfs makes XTRAIN, YTRAIN, ZTRAIN, ..., XTEST, YTEST, ZTEST, ... by picking subsets of the lines of X, Y, Z,... Fun must restore a scalar respect start, at any rate, may accept that inspiration in any capacity. Parts of the genuine vector inmodel relate to segments of X and show which highlights are at long last chosen. 1 [inmodel,history] = sequential fs(fun,X,...) UNIVERSAL ALGORITHMS AND SEQUENTIAL ALGORITHMS 189 Returns data on which include is picked at each development. History is a scalar structure with the running with fields: Crit- A vector containing the model attributes enrolled at each development. In- A sensible framework in which push I shows the highlights picked at step I. []=sequentialfs(..,param1,val1,param2,val2,..) chooses discretionary parameter name/respect sets from the running with table. Table 5.2 Methodologies related to operations. Perform successive component choice for arrangement of uproarious highlights: 1 2 3 4 5 6 7 8 load fisheriris; X = randn(150,10); X(:,[1 3 5 7 ])= meas; y = species; c = cvpartition(y,’k’,10); opts = statset(’display’,’iter’); fun = @(XT,yT,Xt,yt)... 190 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 5.4 NETWORK ROUTING SIMULATION USING MATLAB (sum(˜strcmp(yt,classify(Xt,XT,yT,’quadratic’)))); [fs,history] = sequentialfs(fun,X,y,’cv’,c,’options’,opts) Start forward sequential feature selection: Initial columns included: none Columns that cannot be included: none Step 1, added column 7, criterion value 0.04 Step 2, added column 5, criterion value 0.0266667 Final columns included: 5 7 fs = 0 0 0 0 1 0 1 0 0 0 history = In: [2x10 logical] Crit: [0.0400 0.0267] history.In ans = 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 Acoustic-Centric and Radio-Centric Algorithms Circled transmit beam shaping is a strategy for extending scope and power efficiency through close-by facilitated exertion among neighboring centers to transmit a runof-the-mill message to a remote objective. While its principal feasibility has been set up by continuous examinations and models, changing this plan to applications requires the change of traditions and structures, which can be realized capably using electronic signal getting ready (DSP). In this section, we depict DSP-driven computations and their execution purposes of captivity, and give a record of recent results from entertainments and programming portrayed radio tests. A particular filtering approach to manage to recognize structure set up in free space dynamic uproar control offers the ability to please two blueprint models: distinguishing an overall oversight premise while using a set number of commitments to the control system. Past work around there has received a vibration-driven procedure to secluded isolating, working with either assistant parts or essential modes. The essential of quick and dirty fundamental learning basics in these techniques limit the potential outcomes of moving the different systems from amusement or small scale inquire about office executions to more practical issues. Displayed here is an acoustic-driven methodology that eliminates the necessity for point-by-point learning of the structure, empowering execution for more significant or conceivably more practical issues. The methodology in like manner vanquishes the necessity for system re-plan with each new target structure. While attempting to defeat this issue, dynamic control specialists have directed their concentration toward various assortments of specific sifting. In disconnected segregating [5-9], the fact of the matter is to pick the plentifulness of a game plan as a rule totals, usually fundamental modes, from a liberal number of point estimations. ACOUSTIC-CENTRIC AND RADIO-CENTRIC ALGORITHMS 191 Control systems by then target stifling of the settled separated amplitudes rather than the point estimations themselves. One favored perspective of this methodology is that controller decrease frameworks can most of the time be related clearly to the present terms central to the general response, for instance, utilizing resounding frequencies when working with critical modes. By constraining a plan to just the most urgent (estimated) aggregates, it is conceivable to work with fewer information signals while assessing, to a reasonable accuracy, the general slip standard of intrigue. Both framework graph feelings can be met. While free space sound fields do not have “modes,” a kept isolating approach to manage regulate structure use can be gotten using some start ability to portray the general misconception reason of interest, normally transmitted acoustic power. As recommended in Table 5.3, most work to date has gotten a vibration-driven system, utilizing either right-hand parts [10] or crucial modes [8] as the beginning stage. With the basic portion approach, the physical structure is considered as containing a course of action of pieces, much the same as a compelled section show up. Transmitted acoustic power is then conferred as a quadratic utmost of these parts. The eigenvectors of the positive specific framework relating section speeds and transmitted sound power for this situation depict blends of portions that transmit independently. These mixes of parts supplant assistant modes in the customary separated sifting conditions. Table 5.3 Filtering mechanisms for different models in structural problems. The eigen estimations of the weighting cross area, which are sensibly the radiation efficiencies of the related part blends, can be utilized as the clarification behind controller lessen. They can likewise be used as weighting terms in a repeat weighted LQG arrangement work out [11-14]. The essential mode approach is in a general sense the same as or near that of essential modes are used rather than associate parts, and the free oozing aggregates are blends of critical modes, not principal fragments. 192 NETWORK ROUTING SIMULATION USING MATLAB The central portion and aide mode are ways to deal with overseeing understanding of a specific secluding framework for dynamic clamor controls have different qualities and deficiencies. In a like manner, it gives strong points of confinement, rather than discrete parts that can be utilized directly in the design of molded polymer motion picture sensors [8, 13, 15, 16]. The downside to the essential mode approach is that it requires learning the mode shape segments of the physical structure. This meets the needs for basic research office structures, yet is nonsensical for complex structures, for example, substation electrical transformers. This is likewise an obstruction to another associate mode-based sensor setup approach [17]. In this way, the essential part approach must be re-associated with each issue yet again. The assistant segment approach is in like manner not ideally suited to the issue of designing framed piezoelectric polymer film sensors, as the plan of these sensors requires some learning of the breaking point conditions of the goal structure, information not unavoidable in the fundamental segment technique. In both major systems, the self-ruling transmitting sums (the blends of essential segments or modes) are delicately repeated subordinate [8], compelling the repeat extent of utilization in a geometry-subordinate way. The two strategies are furthermore inapplicable to systems where the bustle source is not a vibrating structure; for example, pipe incapacitating systems. Neither one of the methodologies has, to date, been grasped for systems using sensors in the acoustic space rather than in the structure. While the usage of multipoles to separate unique uproar control issues is not new, past use had focused on issues of updating the number and course of action of control actuators to restrain an acoustic radiation execution measure [18], and not on recognizing structure plot. Using acoustic multipoles in place of assistant segments or essential modes in the particular filtering vanquishes the necessity for unequivocal data of the goal structure (mode shapes, revise estimations, etc.), and provides a reasonable method for plotting an acoustic sensor-based system. Moreover, the methodology is a fitting for identifying system plan for issues excluding a transmitting structure, for instance, air blowers and conductor drains. There are, regardless, problems to be overcome with translation to a vibration-sensor-based execution, which, like the assistant part approach, must use point sensors as the necessary information essential to set up shaped piezoelectric polymer film sensors is absent. There are likewise challenges in structure showing [19] and effective execution. This section delineates the change and execution of a particular channel different system for dynamic commotion control using multi-shaft radiation plans to introduce limits. The theoretical change will be dense, as most purposes of intrigue have been shown elsewhere [19]. Scattered transmit pillar framing (DTB) is a remote transmission framework where a social occasion of transmitters deals with a virtual radio wire display to accommodatingly transmit an ordinary message signal to an out of reach beneficiary. This technique is appealing in light of the way that it empowers center points with fundamental omni-directional gathering contraptions to helpfully get the directivity (and related essentialness capability benefits) of radio wire shows. For a supportive display of N center points with transmitting control P per center point, the gained power at the objective concerns PN2. With the desire for complimentary space transmission, a 10-center-point virtual show can give run development by a factor of 10, or, ACOUSTIC-CENTRIC AND RADIO-CENTRIC ALGORITHMS 193 for settled range, diminish control per center point by a factor of 100, and total transmitted power by a factor of 10. This can drastically influence the size, weight and power (SWaP) of remote contraptions and on a fundamental level expand the lifetime of structures working off batteries. The first test in understanding the significant potential increments from appropriated transmit pillar framing is in unquestionably synchronizing the individual RF signals from each planning transmitter with the objective that they are balanced in organizing at the recipient. Since each center point in a spread display decides its RF transporter movement from apportioned neighborhood oscillators, it is vital to check, track and compensate for balances of these oscillators. In this section, we see that the synchronization functionalities for spread shaft shaping can as a general rule be executed in a DSP-driven baseband configuration, using off-the-rack RF hardware. This is by virtue of the fact that, while RF signals at high frequencies cannot be particularly digitized, the relative repeat offsets two oscillators which are of adequately small size to process precisely. We discuss an illustrative DSP-driven plan from the perspective of a clear Kalman filtering framework for setting up and keeping up synchronization between oscillators overwhelmingly with low overheads, using an essential stage estimation figuring as a building square. We show propagation results, and likewise, the outcomes of promising groundwork examinations on an item portrayed radio testbed in Figure 5.21 and Figure 5.22. Figure 5.21 Estimation of frequency relation to error over time. 194 NETWORK ROUTING SIMULATION USING MATLAB Figure 5.22 5.5 Radiation readings for distributed beamforming. AODV Routing Protocol A center that receives such message as well as holds a course to a pinned center point sends a retrogressive message through short courses to the requesting center point. The center point that began the interest uses the course containing a negligible number of ricochets through various center points. The “areas that are not used in directing tables are reused after some time. AODV enables dynamic, self-start, multi-ricochet guiding between flexible center points wishing to set up and keep up an unrehearsed framework.” [46, 47, 77] AODV avoids the “counting to unlimited quality” issue by using actual plan numbers. This impacts AODV to circle free. AODV portrays three message forms: Route Requests (RREQs) Route Replies (RREPs) Route Errors (RERRs) RREQ messages are used to begin the course finding process. RREP messages are used to settle the courses. RERR messages are used to instruct the framework concerning an association breakage in a practical course. The AODV tradition is used when two endpoints do not have a free unique course to one another. AODV ROUTING PROTOCOL 195 Center points keep a “forerunner rundown” that contains the IP address for each one of its neighbors that are presumably going to use it for a next ricochet in their coordinating table. Course table information must be kept for all courses notwithstanding short courses. The directing table fields used by AODV are: Destination IP Address Destination Sequence Number Valid Destination Sequence Number Flag Other State and Directing Standards Network Interface Hop Count Next Hop List of Precursors Lifetime Essential Example Center point A is necessary to establish a connection on center E. A significant course ought to be made among A and E. Focus point A makes a RREQ message with the beginning TTL of 1 and passes it on to its neighbors (for this condition focus point B). The Message contains among other things focus point A’s IP address and the IP address of focus E. If inside point B has a practical course to focus point E, then B will send a RREP message back to focus A. On the off chance that A sets an exceptional standard in the RREQ message, focus point B will in like manner send an “unnecessary” RREP message to focus E. 196 NETWORK ROUTING SIMULATION USING MATLAB This will be focal if focus point B should send bundles back to A, i.e., a TCP connection. RREP messages are unicast to the going with bounce toward the originator or target if it is a futile RREP. If A does not get a RREP message inside a specific time, it will re-confer the RREQ message with extended TTL respect. Default augmentation is 2. “Change” courses to the originator; for this condition, center point A is made as RREQ messages are sent. The dynamic course is set up when A gets a RREP message. This direct (Incrementing TTL) keeps organizing use down. 5.5.1 Keeping Up Sequence Numbers The best help of movement numbers is essential to keeping AODV circle free and likewise sidestepping the “checking to vastness” issue. Sending focus focuses animate their set away course of action number for a given target when sending RREP messages and precisely when: The get-together number in the controlling table is invalid, or The get-together number in the RREP message is more evident than the set away number, or The get-together numbers are indistinct, at any rate, the course is separate as lethargic, or The approach numbers are the same, yet the ricochet tally is smaller for the RREP message. Focuses starting RREQ messages must develop their particular movement number before transmitting the RREQ. Target focus focuses increase their course of action numbers when the social affair number in the RREQ is proportionate to their anchored number. 5.5.2 Association Breaks RERR message preparing is started when: Node sees an affiliation break that goes with the bounce of a working course, or AODV ROUTING PROTOCOL 197 Receives a piece of information appropriate for a middle point for which it has no (dynamic) course, or Receives a RERR message from a neighbor for not shy of one intense course in its controlling table. Focus focuses must expand the target course of action measures of the planning sections contained in the RERR message before transmitting to focuses on the antecedent summary. Focus focuses on enduring RERR messages that fundamentally animate their gettogether numbers with those contained in the RERR message. Focus directs should in a like manner stamp these planning regions as invalid, paying little respect to whether they are transmitting and furthermore enduring. RREQ messages are over the long haul sent back to the originator who may start another RREQ message. 5.5.3 Neighborhood Repairs Focuses perceiving an affiliation breakage can repair the affiliation if conceivable. The just inside developments target gathering number and passes on a RREQ message. If it gets a RREP message, then the repair was profitable. 5.5.4 Security Considerations At present, AODV has no prosperity attempts worked in. If the system intrigue is known, by then confirmation can be utilized on the AODV control messages. Below are the situation codes for the AODV Process. In this strategy we have a couple of kinds as took after: 1. AODV GUI in WSN (aodv.m) 2. Equal.m 3. Main.m 4. Nwpath.m 5. Points.m In the going with section we can see each code in inconspicuous components Aodv.m 1 2 3 4 5 Function [total_dist,path]=aodv(src_nodel,dst_node,inrange,nodeloc) %% function to plot shortest path using AODV protocol Src_node=src_nodel; % to reset the src_node to original source node after every 198 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 NETWORK ROUTING SIMULATION USING MATLAB % iteration of n=1:citysize Rtngble=src_node;% initialise Tble1=src_node;% initialise Tble=src_node;% initialise Cnt=1;% initialise Cnt1=1; % initialise Counter=1; Dimnsn(cnt)=nume1(rtngtble); Whie rtngtble˜=dst_node For ii=1:nume1(tble1) Src_node=tble1(ii); Temp=find(inrange(src_node,:)); Temp=temp(find(ismember(temp,tble)==0)); Str{cnt1}=[src_node,temp]; Tble=[tble, temp]; Cnt1=cnt1+1; End Tble1=tble(find(ismember(tble,rtngtble)==0)); %.................................................................. % seprate nodes which are not present in routing table %.................................................................. Rtngtble=[rtngtble,tble]; %remove the repeated node in table [any,index]=unique( rtng,’first’); Rtngtble=rtngtble(sort(index)); If ismember(dst_node,rtngtble) % find out which structure cell has destination node Dst_cell=find(cellfun(@equal,str,repmat({dst_node}, 1,length(str)))); Dst=dst_cell; Nodtbl=dst_node; Frst_node=dst; While frst_node˜=src_node1 Frst_node=str{dst(1)}(1); Dst=find(cellfun(@equal, str,repmat({frst_node},1,length(str)))); Nodtble=[nodtble, frst_node]; End Msgbox(’path found’) Nodtble=fliplr(nodtble) % final routing table Route{count}=nodtblle; %.................................................................. % save all AODV paths for each change in vehicle position into % a structure take out the distance of nodes in routing table % from each other %.................................................................. For ii=1:nume1(nodtble)-1 Distnc(ii)=sqrt((nodeloc(nodtble(ii+1),1) -nodeloc(nodtble(ii),1))ˆ2+(nodeloc(nodtble(ii+1),2) -nodeloc(nodtble(ii),2))ˆ2); End % total distance from source to destination AODV ROUTING PROTOCOL 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 199 Total-dist=sum(distnc); %.................................................................. %Total distance between hops in ADDV path %.................................................................. Distance(counter)=total_dist; Counter=counter+1; End Cnt=cnt+1; Dimnsn(cnt)=nume1(rtngtble); If nume1(rtngtble)==1 Mdgbox(’1-node in range,Execute again’) Return End If cnt>=5 h8=msgbox(’No path found’); break end end if ˜exist(’nodtble’,’var’); errordlg(’Transmission Range is less,kindly enhance it ’) return end path=nodtble; end Equal.m 1 2 3 4 5 6 7 8 function log=equal(inpu,dst) % dst=35; If ismember(dst,inpu) Log=1; Else Log=0; End end Main.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 clear all close all clc %% global hmain hmain=figure(1); %.................................................................. %set the area edit box %.................................................................. ui control(’style’,’text’,’units’,normalize’,’position’, [0.82 0.900 0.150 0.05],’string’,’enter the area’); gui.edit=uicontrol(’style’,’edit’,’units’,’normalize’, ’position’, [0.84 0.850 0.100 0.05],’backgroundColor’,’white’); %.................................................................. % set the node number edit box %.................................................................. uicontrol(’style’,’text’,’units’,’normalize’,’position’, 200 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 NETWORK ROUTING SIMULATION USING MATLAB [0.82 0.780 0.150 0.07],’string’,’enter the node no’); gui.nodes=uicontrol(’style’,’edit’,’units’,’normalize’,’position’, [0.82 0.780 0.150 0.07],’string’,’backgroundColor’,’white’); %.................................................................. % set the node grid size edit box %.................................................................. uicontrol(’style’,’text’,’units’,’normalize’,’position’, [0.82 0.660 0.150 0.07],’string’,’enter the grid size’); gui.grid=uicontrol(’style’,’edit’,’units’,’normalize’,’position’, [0.84 0.610 0.100 0.05],’string’,’backgroundColor’,’white’); %.................................................................. % uicontrol(’style’,’text’,’units’,normalize’,’position’, % [0.82 0.45 0.152 0.05],’string’,’enter the source’); %gui.src=uicontrol(’style’,’edit’,’units’,’Normalize’,’Position’, %[0.84 0.50 0.100 0.05],’BackgroundColor’,’white’); %.................................................................. uicontrol(’style’,’text’,’units’,’normalize’,’position’, [0.82 0.55 0.152 0.05],’string’,’base stations no.’); gui.dst=uicontrol(’style’,’edit’,’units’,’normalize’,’position’, [0.84 0.50 0.100 0.05],’string’,’backgroundColor’,’white’); uicontrol(’style’,’text’,’units’,’normalize’,’position’, [0.82 0.45 0.152 0.05],’string’,’no. of packets’); gui.pkt=uicontrol(’style’,’edit’,’units’,’normalize’,’position’, [0.84 0.40 0.100 0.05],’string’,’backgroundColor’,’white’); uicontrol(’style’,’text’,’units’,’normalize’,’position’, [0.80 0.32 0.200 0.08],’string’,’enter the transmission range’); gui.range=uicontrol(’style’,’edit’,’units’,’normalize’,’position’, [0.84 0.26 0.100 0.05],’string’,’backgroundColor’,’white’); gui.button=uicontrol(’style’,’pushbuttton’,’units’,’normalize’, ’position’, [0.84 0.21 0.100 0.05],’string’,’plot path’,,’callback’, @nwpath,’backgroundColor’,’cyan’); %.................................................................. % uicontrol(’style’,’pushbuttton’,’units’,’normalize’,’position’, % [0.70 0.01 0.100 0.05],’string’,’clear All’ % ,callback’,@cla,’backgroundColor’,’cyan’); %.................................................................. set(axes,’position’,[0.1,0.1,0.7,0.7]) %.................................................................. %% available the variables values for other functions usage %.................................................................. handles.gui=gui; guidata(hmain,handles) get(gui.edit,’value’) %% Points.m 1 2 3 4 5 %.................................................................. %% function to take ot points between any two points %.................................................................. function [x, y]=points(x1,y1,x2,y2) AODV ROUTING PROTOCOL 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 201 x1=round(x1); x2=round(x2); y1=round(y1); y2=round(y2); dx=abs(x2-x1); dy=abs(y2-y1); steep=abs(dy)>abs(dx); if steep t=dx; dx=dy; dy=t; end %.................................................................. %the main algorithm goes here. %.................................................................. if dy==0 q=zeros(dx+1,1); else q=[0;diff(mod([floor(dx/2):-dy:-dy*dx+floor(dx/2)]’,dx))>=0]; end %.................................................................. %and ends here. %.................................................................. if steep if y1<=y2 y=[y1:y2]’; else y=[y1:-1:y2]’; end if x1<=x2 x=x1+cumsum(q); else x=x1-cumsum(q); end else if x1<=x2 x=[x1:x2]’; else x=[x1:-1:x2]’; end if y1<=y2 y=y1+cumsum(q); else y=y1-cumsum(q); end end Newpath.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 %.................................................................. %% this function plots the path between source and destination %% plot the network %.................................................................. function nwpath(hObject,event) global hmain nodeloc nodes gui=guidata(hmain); area=str2num(get(gui.gui.edit,’String’)) nodes=str2num(get.gui.nodes,’String)) grid_size=str2num(get(gui.gui.grid,’String’)) %.................................................................. % validation of grid size %.................................................................. if rem(area,grid_size)˜=0 errordlg(’Enter the grid size so that equal number of grids are formed in the area’) return end 202 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 NETWORK ROUTING SIMULATION USING MATLAB %.................................................................. % random positions of nodes %.................................................................. nodeloc=(area-0)*rand(nodes,2); %.................................................................. % geographical area plotting %.................................................................. axis([0,area,0,area]) title([’network plotting foor area =’,num2str(area),’mˆ2 & number of nodes =’,num2str(nodes),’with grid size ’, num2str(grid_size),’ mˆ2]) Hold on For ii=1:nodes % nodes’ plottinf Plot(nodeloc(ii,1),nodeloc(ii,2),’r*’) Text(nodeloc(ii,1),nodeloc(ii,2),num2str(ii)) hold on End For ii=1:area/grid_size % change in y grid position Y=(grid_size)*ii; Plot(1:area,repmat(y,area,1),’k’) Hold on End For ii=1:area/grid_size % change in y grid position x=(grid_size)*ii; Plot(repmat(x,area,1),1:area,’k’) hold on End %.................................................................. %% plot the path and route %.................................................................. range=str2num(get(gui.gui.range,’String’)) %.................................................................. % get the destination node %.................................................................. Dstno=str2num(get(gui.gui.dst,’String’)); For ii=1:dstno dst(ii)=round((nodes-1)*rand+1); plot(nodeloc(dst(ii),1),nodeloc(dst(ii),2),’hk’,’markerSize’, 10, ’MarkerFaceColor’,[1,1,0]) end %.................................................................. % get no of packets %.................................................................. pkt=str2num(get(gui.gui.pkt,’String’)); %.................................................................. % text(nodeloc(dst,1),nodeloc(dst,2),’dst’) %.................................................................. for ii=1:nodes CONCLUSION 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 5.6 203 for jj=1:nodes dist(ii,jj)=sqrt((nodeloc(ii,1)-nodeloc(jj,1))ˆ2 +(nodeloc(ii,2)-nodeloc(jj,2))ˆ2); if dist(ii,jj)<=Range inrange(ii,jj)=1; else inrange(ii,jj)=0; end end end for jj=1:pkt src=round((nodes-1)*rand+1); %.................................................................. % generate the random source node for each packet % to check source node doesn’t overlap with destination source nodes %.................................................................. if ismember(src,dst) src=round((nodes-1)*rand+1); end plot(nodeloc(src,1),nodeloc(src,2),’hg’,’markerSize’,10, ’markerfacecolor’,[0,1,0]) text(nodeloc(src,1)+1,nodeloc(src,2),’Source’, ’backgroundcolor’,[.7 .9 .7]) for ii=1:dstno [totdist(ii),path{ii}]=aodv(src,dst(ii),inrange,nodeloc); end [˜,index]=min(totdist); plot(nodeloc(path{index},1),nodeloc(path{index},2), ’k’,’linewidth’,2) for kk=1:nume1(path{index})-1 [x,y]=points(nodeloc(path{index}(kk),1), nodeloc(path{index}(kk),2),nodeloc9path{index} (kk+1),1), nodeloc(path{index}(kk+1),2)); for pp=1:size(x,1) h2=text(x(pp),y(pp),[num2str(jj),’packet’], ’backgroundcolor’, [.7 .9 .7]); pause(0.01) set(h2(),’visible’,’off’); end end end end % end Conclusion This chapter explained the scenarios of causality measures. These kinds of measures identify the different scenarios in which we can get knowledge on designing the view points in MATLAB, which are connected with the communication of each device and the implementation states of the concept of different frameworks used for the recreation of the data or the information. The information recreated will be 204 NETWORK ROUTING SIMULATION USING MATLAB helpful for further communication and securing the data for further communications. This information is further transferred and managed using different frameworks of MATLAB. In this chapter we mainly focused on different sorts of information and applications that are used in the wide range of framework implementations. For example, we explained the process of demand modeling and how to approach it for model development using MATLAB. We discussed different networking protocols like AODV and implementation was explained using the code. REFERENCES 1. Wiener, N. (1956). Nonlinear prediction and dynamics. In Proceedings of the Third Berkeley Symposium on Mathematical Statistics and Probability (Vol. 3, pp. 247-252). Berkeley, University of California Press. 2. Schreiber, T. (2000). Measuring information transfer. Physical review letters, 85(2), 461. 3. Gourieroux, C., Gourieroux, M., Monfort, A., & Monfort, D. A. (1996). Simulationbased econometric methods. Oxford university press. 4. Palu, M., Komrek, V., Hrn, Z., & trbov, K. (2001). Synchronization as adjustment of information rates: detection from bivariate time series. Physical Review E, 63(4), 046211. 5. Meirovitch, L., & Baruh, H. (1985). The implementation of modal filters for control of structures. Journal of Guidance, Control, and Dynamics, 8(6), 707-716. 6. Lee, C. K., & Moon, F. C. (1990). Modal sensors/actuators. Journal of applied mechanics, 57(2), 434-441. 7. Morgan, D. P., Morgan, D. P., Morgan, D. P., & Morgan, D. P. (1985). Surface-wave devices for signal processing (Vol. 1991). Amsterdam: Elsevier. 8. Snyder, S. D., & Tanaka, N. (1993). On feedforward active control of sound and vibration using vibration error signals. The Journal of the Acoustical Society of America, 94(4), 2181-2193. 9. Hansen, C. H., & Snyder, S. D. (1997). Active control of sound and vibration. London: E&FN Spon. 10. Elliott, S. J., & Johnson, M. E. (1993). Radiation modes and the active control of sound power. The Journal of the Acoustical Society of America, 94(4), 2194-2204. 11. Gupta, N. (1980). Frequency shaped cost functionals: extension of LQG design methods. JGC, 549, 553. 12. Anderson, B. D. O., & Moore, J. B. (1981). Detectability and stabilizability of timevarying discrete-time linear systems. SIAM Journal on Control and Optimization, 19(1), 20-32. 13. Snyder, S. D., Hansen, C. H., & Tanaka, N. (1993, April). Shaped vibration sensors for feedforward control of structural radiation. In Proceedings of the second conference on recent advances in active control of sound and vibration (pp. 177-188). 14. Baumann, W. T., Ho, F. S., & Robertshaw, H. H. (1992). Active structural acoustic control of broadband disturbances. The Journal of the Acoustical Society of America, 92(4), 1998-2005. CONCLUSION 205 15. Snyder, S. D., Tanaka, N., & Kikushima, Y. (1995). The use of optimally shaped piezoelectric film sensors in the active control of free field structural radiation, Part 1: Feedforward control. Journal of vibration and acoustics, 117(3A), 311-322. 16. Tanaka, N., Snyder, S. D., & Hansen, C. H. (1996). Vorticity characteristics of the vibrational intensity field in an actively controlled thin plate. The Journal of the Acoustical Society of America, 99(2), 942-953. 17. Maillard, J. P., & Fuller, C. R. (1994). Advanced time domain wavenumber sensing for structural acoustic systems. I. Theory and design. The Journal of the Acoustical Society of America, 95(6), 3252-3261. 18. Koopmann, G. H., Song, L., & Fahnline, J. B. (1989). A method for computing acoustic fields based on the principle of wave superposition. The Journal of the Acoustical Society of America, 86(6), 2433-2438. 19. Hill, S. G., Snyder, S. D., Cazzolato, B. S., Tanaka, N., & Fukuda, R. (2002). A generalized approach to modal filtering for active noise control. II. Acoustic Sensing. IEEE sensors journal, 2(6), 590-596. 20. Greicius MD, Krasnow B, Reiss AL, Menon V (2003) Functional connectivity in the resting brain: A network analysis of the default mode hypothesis. Proc NatlAcad Sci U S A 100: 253-258. 21. Roebroeck, A., Formisano, E., & Goebel, R. (2011). The identification of interacting networks in the brain using fMRI: model selection, causality, and deconvolution. Neuroimage, 58(2), 296-302. 22. Cohen, A. L., Fair, D. A., Dosenbach, N. U., Miezin, F. M., Dierker, D., Van Essen, D. C., ... & Petersen, S. E. (2008). Defining functional areas in individual human brains using resting functional connectivity MRI. Neuroimage, 41(1), 45-57. 23. David, O. (2011). fMRI connectivity, meaning and empiricism Comments on: Roebroeck et al. The identification of interacting networks in the brain using fMRI: model selection, causality and deconvolution. Neuroimage, 58(2), 306-9. 24. Tang, W., Bressler, S. L., Sylvester, C. M., Shulman, G. L., & Corbetta, M. (2012). Measuring Granger causality between cortical regions from voxelwise fMRI BOLD signals with LASSO. PLoS computational biology, 8(5), e1002513. 25. He, B. J., Snyder, A. Z., Vincent, J. L., Epstein, A., Shulman, G. L., & Corbetta, M. (2007). Breakdown of functional connectivity in frontoparietal networks underlies behavioral deficits in spatial neglect. Neuron, 53(6), 905-918. 26. Sporn, O., Cammoun, L., Gigandet, X., Meuli, R., Honey, C., & Hagmann, P. (2008). Mapping the Structural Core of Human Cerebral Cortex. In 2008.06. 15-19, OHBM 2008, 14th Annual Meeting of the Organization for Human Brain Mapping. Melbourne, Australia. 27. Anderson, J. S., Ferguson, M. A., Lopez-Larson, M., & Yurgelun-Todd, D. (2010). Topographic maps of multisensory attention. Proceedings of the National Academy of Sciences, 201011616. 28. Sylvester, C. M., Shulman, G. L., Jack, A. I., & Corbetta, M. (2007). Asymmetry of anticipatory activity in visual cortex predicts the locus of attention and perception. Journal of Neuroscience, 27(52), 14424-14433. 29. Valds-Sosa, P. A., Snchez-Bornot, J. M., Lage-Castellanos, A., Vega-Hernndez, M., Bosch-Bayard, J., Melie-Garca, L., & Canales-Rodrguez, E. (2005). Estimating brain 206 NETWORK ROUTING SIMULATION USING MATLAB functional connectivity with sparse multivariate autoregression. Philosophical Transactions of the Royal Society B: Biological Sciences, 360(1457), 969-981. 30. Tibshirani, R. (2011). Regression shrinkage and selection via the lasso: a retrospective. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 73(3), 273282. 31. Arnold, A., Liu, Y., & Abe, N. (2007, August). Temporal causal modeling with graphical granger methods. In Proceedings of the 13th ACM SIGKDD international conference on Knowledge discovery and data mining (pp. 66-75). ACM. 32. Shojaie, A., & Michailidis, G. (2010). Discovering graphical Granger causality using the truncating lasso penalty. Bioinformatics, 26(18), i517-i523. 33. Snchez-Bornot, J. M., Martnez-Montes, E., Lage-Castellanos, A., Vega-Hernndez, M., & Valds-Sosa, P. A. (2008). Uncovering sparse brain effective connectivity: A voxelbased approach using penalized regression. Statistica Sinica, 1501-1518. 34. Garg, R., Cecchi, G. A., & Rao, A. R. (2011). Full-brain auto-regressive modeling (FARM) using fMRI. Neuroimage, 58(2), 416-441. 35. Wiener N. Modern Mathematics for the Engineer. New York: McGraw-Hill; 1956. The theory of prediction. pp. 165-190. 36. Granger, C. W. (1969). Investigating causal relations by econometric models and crossspectral methods. Econometrica: Journal of the Econometric Society, 424-438. 37. Bernasconi, C., & Konig, P. (1999). On the directionality of cortical interactions studied by structural analysis of electrophysiological recordings. Biological cybernetics, 81(3), 199-210. 38. Ding, M., Bressler, S. L., Yang, W., & Liang, H. (2000). Short-window spectral analysis of cortical event-related potentials by adaptive multivariate autoregressive modeling: data preprocessing, model validation, and variability assessment. Biological cybernetics, 83(1), 35-45. 39. Hesse, W., Mller, E., Arnold, M., & Schack, B. (2003). The use of time-variant EEG Granger causality for inspecting directed interdependencies of neural assemblies. Journal of neuroscience methods, 124(1), 27-44. 40. Roebroeck, A., Formisano, E., & Goebel, R. (2011). The identification of interacting networks in the brain using fMRI: model selection, causality and deconvolution. Neuroimage, 58(2), 296-302. 41. Purohit, G. N., Sherry, A. M., & Saraswat, M. (2013). Optimization of function by using a new MATLAB based genetic algorithm procedure. International journal of computer applications, 61(15). 42. Lakhotia, K., Harman, M., & McMinn, P. (2007, July). A multi-objective approach to search-based test data generation. In Proceedings of the 9th annual conference on Genetic and evolutionary computation (pp. 1098-1105). ACM. 43. Henriksson, D., Cervin, A., & rzn, K. E. (2003, October). TrueTime: Real-time control system simulation with MATLAB/Simulink. In Proceedings of the Nordic MATLAB Conference. Copenhagen, Denmark. 44. Grefenstette, J. J. (1992, September). Genetic algorithms for changing environments. In PPSN (Vol. 2, pp. 137-144). CONCLUSION 207 45. Pohlheim, H. (1998). Genetic and Evolutionary Algorithm Toolbox for use with MATLAB. Dept. Comput. Sci., Univ. Ilmenau, Ilmenau, Germany. Retrieved from http://www.geatbx.com/download/GEATbx Tutorial v33c. pdf. 46. Brendha, R., & Prakash, V. S. J. (2017, January). A survey on routing protocols for vehicular Ad Hoc networks. In 2017 4th International Conference on Advanced Computing and Communication Systems (ICACCS) (pp. 1-7). IEEE. 47. AL-Dhief, F. T., Sabri, N., Salim, M. S., Fouad, S., & Aljunid, S. A. (2018). MANET routing protocols evaluation: AODV, DSR and DSDV perspective. In MATEC web of conferences (Vol. 150, p. 06024). EDP Sciences. 48. Lindfield, G., & Penny, J. (2018). Numerical methods: using MATLAB. Academic Press. 49. Irurozki, E. K. H. I. N. E., Ceberio, J. O. S. U., Santamaria, J. O. S. E. A. N., Santana, R. O. B. E. R. T. O., & Mendiburu, A. L. E. X. A. N. D. E. R. (2018). perm mateda: A matlab toolbox of estimation of distribution algorithms for permutation-based combinatorial optimization problems. 50. Chandramouli, S. (2019). MATLAB Code for Linking Genetic Algorithm and EPANET for Reliability Based Optimal Design of a Water Distribution Network. In Water Resources and Environmental Engineering I (pp. 183-194). Springer, Singapore. 51. He, B. J., Snyder, A. Z., Vincent, J. L., Epstein, A., Shulman, G. L., & Corbetta, M. (2007). Breakdown of functional connectivity in frontoparietal networks underlies behavioral deficits in spatial neglect. Neuron, 53(6), 905-918. CHAPTER 6 WIRELESS NETWORK SIMULATION USING MATLAB Abstract In this chapter, we explain how wireless network simulations can be done using MATLAB. We also explain how shadowing methods are used for radio propagation, two-ray model, indoor propagation, classical empirical model, Hata model, Walfish-Ikegami model, Erceg model, multi-slope model, dispersive model, 3GPP SCM, MAC: IEEE 802.11 (CSMA/CA, virtual carrier sense, and RTS-CTS-DATAACK), NET ad hoc routing, APP-overlay routing protocols, etc. Keywords: Ad hoc routing, CSMA/CA, shadowing methods Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 209 210 WIRELESS NETWORK SIMULATION USING MATLAB 6.1 Radio Propagation for Shadowing Methods 6.1.1 Radio Propagation Modeling Radio propagation modeling shows expansion properties as well as models for cell structures. Moreover, it condenses basic thoughts and grows a bit on a couple of parts of settled-versus-convenient and indoor-versus-outdoors expansion showing [1, 7]. Before preceding with inspecting unaffected components, a few documentation conventions are imperative. Wireless exchange indications of interest are in electromagnetic waves, as well as free space from the electric field. Control thickness of the electromagnetic wave made as Poynting vector: = ×. Power thickness is the modulus of the Poynting vector Pd = |. Likewise, perceive got movement with got electric field; and the show got hail: R(t) = r(t).exp(j 2 πf t) Gained power densities: P d(t) = |R(t)| 2 γ0 (6.1) (6.2) Gained power Pr moreover depends upon the convincing area of getting receiving wire: 2 Pr (t) = Ae Pd (t) = Ae |R(t)| (6.3) γ0 6.1.2 Partition Dependence Adversity is approximated by Equation (6.4) below: L(d) = L0 + 10n × log( d ) d0 (6.4) where n is the mishap, which changes with the prospect as well as condition, and L0 and d0 are delineated parameters. 6.1.3 Small-Scale Blurring Small-scale blurring creates an extraordinary variety inside a half wavelength. The major reason for this is multipath, and moving scatters. Occurring blurs are generally approximated by Rayleigh, Rician, or comparable blurring insights; estimations additionally demonstrate a stable match for Nakagami-m as well as Weibull conveyances. Radio frameworks depend upon decent variety, adjusting, channel coding, as well as interleaving plans which alleviate the effect. RADIO PROPAGATION FOR SHADOWING METHODS 211 Distinctive range groups have different engendering qualities altogether and require diverse expectation models. Some spread models are appropriate for PC reenactment in the nearness of nitty-gritty prospect and building information; others go for providing a more straightforward general way to gauge errors. 6.1.4 Free-Space Propagation The least complicated method is used to assess power proportion amongst transmitter and the collector as an element of separate division d, what percentage was somewhat unusual. Physical contention and protection of vitality prompt the Friis capacity transmission equation [13, 16]. Transmitted power source emanates circularly by a receiving wire gain Gt ; Pr = P t G t Ae 4πd2 (6.5) Successful zone of a receiving wire can be identified with reception apparatus gain by Gr Ae (6.6) = γ2 4π which is mainly utilized for accepting radio wire, Gt Gr λ2 Pr = Pτ (4πd)2 (6.7) Figure 6.1 Spherical free-space propagation: power transmitted over the air radiates spherically, with different gain in different directions. A portion of that power is received on an active aperture area Ae of the receiving antenna. The above-given condition demonstrates free-space reliance in ( d12 ), as well as some of the time communicated in decibels (dB): L(dB) = 10 × log( Pt ) Pr (6.8) In many cases, antenna gains are considered separately, and one chooses to focus on the path loss between the two antennas. The path loss reflects how much power is 212 WIRELESS NETWORK SIMULATION USING MATLAB dissipated between transceiver and receiver antennas (without counting any antenna gain). The path loss variation with distance is d2 , or 20log(d) in dB, which is characteristic of a free space model. The exponent (here n = 2) is called the path loss exponent, and its value varies with models. Path loss is often expressed as a function of frequency (f ), distance (d), and a scaling constant that contains all other factors of the formula. For instance: L(dB) = 32.45 + 20 × log( d f ) + 20 × log( ) f0 d0 (6.9) where f0 = 1 MHz, and d0 = 1 km. These reference values are arbitrary and chosen to be convenient to use values in MHz and km in the formula. Note that the constant 32.45 changes if the reference frequency f0 and the reference distance d0 are chosen to be different. Many presentations will refer to the formula as L(dB) = 32.45 + 20 × log(f ) + 20 × log(d), adding a statement such as “f is in MHz and d is in km.” That shorter notation is equivalent to Equation (6.9), but should be treated carefully; with the loss of f0 and d0 in the equation, mistakes can be introduced by further manipulating the expression. 6.1.5 Ray Tracing Ray tracing is a method that uses a geometric approach, and examines what paths the wireless radio signal takes from transmitter to receiver, as if each path was a ray of light (reflecting off surfaces). Ray-tracing predictions are good when detailed information of the area is available. But the predicted results may not be applicable to other locations, thus making these models site-specific. Nevertheless, fairly general models may be devised from ray-tracing concepts. The well-known two-ray model uses the fact that for most wireless propagation cases, two paths exist from transmitter to receiver: a direct path and a bounce off the ground. That model alone shows some important variations of the received signal with distance. Ray-tracing models are extensively used in software propagation prediction packages, which justifies a closer look at them in this section. 6.1.5.1 Ray-Tracing Notations Rays are an optical approximation of the electromagnetic wave; as seen earlier, in free space it is convenient to focus on the propagation of the electric field. The (complex) transmitted electric field is noted as S(t), the received field is R(t), and we define the ratio p0 (t) = R(t) S(t) . Then the power link budget between transmitter and receiver can be written Pr = |p0 |2 (6.10) Pt In the next few subsections, we will consider how the electric field propagates, and we will compute various expressions for p0 (t) in various conditions; each time the final step will be to take its modulus squared in order to derive the path loss. RADIO PROPAGATION FOR SHADOWING METHODS 6.1.5.2 213 Two-Ray Model With the help of a few documentation customs, we can decide a direct yet profitable model which consist of two pillars. Figure 6.2 Ray model geometry. Figure 6.2 above demonstrates a settled pinnacle (for example, in a cell framework) with tallness hb , as well as customer gadget at separation d0 , at the final stage stature hm (typically lower). It is anything but difficult to see from this assume the two-way lengths are: l0 = and l0 = (d20 + (hb − hm )2 (6.11) d20 + (hb + hm )2 (6.12) The value for distance d0 is given below: R0 (t) = ⎛ ⎞ j2πl j2πl0 1 λ ⎝ s(t)e λ s(t − τ )e λ ⎠ (Gt Gr ) + τ1 4π l0 l0 (6.13) where λ= c f is the wavelength; τ is time contrast between the two ways; and Γ is the ground reflection coefficient. For the time being, let us accept an idealized reflection and utilize Γ = −1: will expound promote on Γ. For model rearrangement, critical presumption must be used. Here τ is slightly contrasted with image length of valuable data, which is, s(t) = s(t − τ ) (6.14) 214 WIRELESS NETWORK SIMULATION USING MATLAB So finally, we obtain: p0 (t) = ⎛ ⎞ j2πl j2πl exp( λ 0 ) λ ⎝ exp( λ 0 ) ⎠ (Gt Gr ) +Γ 4π l0 l0 (6.15) Basic spread models: free-space one-incline coordinate observable pathway, and two-beam with coordinate beam and ground reflected beam. Figure 6.3 speaks to the odd constriction, Pr = |p0 |2 (in dB) Pt (6.16) Figure 6.3 Simple propagation models: free-space one-slope direct line of sight, and tworay with direct ray and ground reflected ray. In some places, signal adds constructively, in others phase differences cause deep fades. It is a component logarithm of separation, which utilizes the given values, hb = 8m, hm = 2m, f = 2.4GHz, Gt = Gr = 0dBi. The quick way prompts first on-slant free space display; total articulation prompts the two-beam demonstrate, which indicates fascinating attributes: The nearness of a second beam causes incredible varieties; signs can include or almost drop each other, causing profound blurs over small separations. In nearness, the general envelope of intensity rot shifts in ( d12 ). At the end of a specific cutoff remove the model methodologies control rot in ( d14 ). RADIO PROPAGATION FOR SHADOWING METHODS 6.1.5.3 215 Reflection and Refraction Prior to the process of pushing forward, we have to investigate reflection coefficients utilized for aberrant beams. The points of interest of this investigation originate from limit conditions for electromagnetic waves going between two media. On the ground, the wave impinging on an edge of event θ, the concept polarization will take care of the ground reflection coefficient, and the condition is given as Γ= sinθ − Z sinθ + Z √ 1 r − cos2 θ vert.pol r Z = √ r − cos2 θ horiz.pol and (6.17) (6.18) where, Γ is ground reflection coefficient; Z is trademark impedance of the media; θ is shaft purpose of recurrence; and The r is stunning relative permittivity of the medium: σ r = r − j ≈ r − j60σλ ω0 (6.19) where, – r is lossless relative permittivity; and – σ is conductivity (in Ω−1 m−1 ). The wave typically has many polarized components to it; even when a transmitter uses vertically polarized antennas, different scatterers in the path may depolarize the wave. Nevertheless, the majority of cellular systems use vertical polarization, which is shown empirically to propagate slightly better in most practical cellular environments. In these cases, the electrical field is near vertical, and the reflection (and refraction) on a surface is shown in Figure 6.4. Figure 6.4 Vertical polarization ground reflection coefficient. 216 WIRELESS NETWORK SIMULATION USING MATLAB Figure 6.5 Horizontal polarization ground reflection coefficient. Similarly, rays bouncing off walls have a reflection coefficient (of course the vertically polarized waves now need to be considered as impinging on the surface with electric field near the surface plane as a horizontally polarized wave does on the ground). The qualities which might be utilized for complex permittivity are given in Table 6.1 below.1 Table 6.1 6.1.5.4 Relative permittivity. Multiple Rays Here, more than a two-bar approach could occur without leaving a stretch connected with incorporating an equal number of pillars from required. Counting 4 or more pillars incites a ten-bar show. Quick two pillars were enlisted previously, and new bars are obtained without trouble from a six- and ten-ray model geometry, as shown in Figure 6.6. For straight1 www.fcc.gov/mb/audio/m3/ RADIO PROPAGATION FOR SHADOWING METHODS 217 forwardness, let us move the getting the point not far off at enduring wt from the divider, everything considered partition transmitting to receiving addressed by R1 is d1 = d20 + (2wt )2 . Figure 6.6 Six-ray model (R0 , R1 , R2 ) and ten-ray model (R0 to R4 ) geometry: each line hides two rays, one direct, the other bouncing off the ground. Similar to this, we have: l1 l1 exp(j2π λ ) exp(j2π λ ) λ |p1 (t)| = (Gt Gr ) Γ1 +Γ 4π l1 l1 (6.20) where, l1 = d20 + (2w)2 + (hb − hm )2 (6.21) d20 + (2w)2 + (hb + hm )2 (6.22) and l1 = Γ1 is the refection coefficient off the nearest wall, and is computed from Equations (6.17) and (6.18), but with angles with respect to the walls. Additional rays (R2 and more) can be calculated in expressions resembling Equation (6.20), and added to others in order to produce a multiple-ray model. 218 WIRELESS NETWORK SIMULATION USING MATLAB i=N Figure 6.7 Ray tracing plots of received signal power indicator 20log| i=0 pi | as a function of log d0 for N ∈ {0, 2, 3, 5} for a typical suburban case with street width of 20 feet, and the average distance from the street to the home of wt = 10 feet (so ws = 40 feet). 6.1.5.5 Residential Model The residential models are used in both the urban and rural halls. Some beams get away from the hallway and never achieve the beneficiary, as delineated in Figure 6.8. Figure 6.8 Ray-tracing geometry for a street corridor; some rays escape the corridor through gaps between homes. R3 beams get away from the urban gorge and never achieve the collector. These holes demonstrate a somewhat altered model (Figure 6.9). RADIO PROPAGATION FOR SHADOWING METHODS Figure 6.9 219 Ray-tracing power levels down a street, with gaps between homes. On the other hand, rather than analyzing where beams may get away from the hallway, a streamlined model might be utilized that considers a power odd relative to the holes. 6.1.5.6 Indoor Penetration The majority of the cell towers are set outside, where 80% of the telephone calls were set inside. Subsequently, the issue of the amount of the signal quality proliferating lesser to the road might be accessible indoors and outdoors. Touching edges of occurrence are to some degree in urban and rural halls. Figure 6.10 demonstrates a run-of-the-mill situation where remote frameworks (base stations or passages) might be put on the opposite side of the road to give scope to living arrangements. Figure 6.10 Beam following impinging on home dividers. 220 WIRELESS NETWORK SIMULATION USING MATLAB Figure 6.11 Angles of incidence illuminating homes in an urban corridor. tanθ1 = wh + ws − wt (n − 1)dp + dhh 2 (6.23) tanθ2 = ws − wt (n − 1)dp + (6.24) tanθ3 = (n − 1)dp + ws − wt dhh 2 tanθ4 = (n − 1)dp − ws − wt dhh 2 dhh 2 (6.25) (6.26) Edges of occurrences between these qualities ought to be utilized to compute entrance odds, for example, Lgc = (1 − sinθ)2 dθ θ5 = 6.1.6 θ4 Lgc Lgc [ 3θ sin2θ θ4 + 2cos2θ − ] 2 4 θ3 Indoor Propagation Proliferation inside a building has some other intriguing issues, as well as being distinctive during signal origination, all things considered, or includes its source inside the building. Moreover, indoor engendering differs extraordinarily on behalf of its kind of structure and situation of passageways inside the building; it is a long way from divider, how high the deterrents and furniture contrast. 3D beam models are used here and there for all the anticipated likely circumstances. RADIO PROPAGATION FOR SHADOWING METHODS 6.1.7 221 Classic Empirical Models Observational modeling types are much easier as well as less site particular, which provide a primary request demonstration to an extensive variety of areas [15]. A bunch of experimental models is broadly acknowledged for cell interchanges; these models normally consist of figuring out misfortune example n from some direct relapse contention on an arrangement of field information and inferring a model like: L(dB) = L0 + 10n × log( d ) d0 (6.27) where the intercept L0 is the path loss at an arbitrary reference distance d0 . 6.1.8 COST 231-Hata Model One-slant test display was gotten from broad estimations in rural regions. Then it was conditioned by Hata. The model gives an extraordinary way to perform hardship examinations on tremendous urban cells by up to 20 kilometers, and other parameters like repeat, base station height, and condition. hB hM f −b −a LHata = c0 + cf log 1M Hz 1m 1m d hB log + CM + 44.9 − 6.55log 1m 1km with the following values: Table 6.2 Values for COST 231 Hata and modified Hata models. Frequency c0 b(hB ) cf (MHz) (dB) (dB) 150-1500 69.55 26.16 13.82 log (dB) 1500-2000 46.3 33.9 13.82 log h B h1m B 1m The parameter a(hM ) is strongly impacted by surrounding buildings, and is sometimes refined according to city sizes, as shown in Table 6.3. Table 6.3 Values of a(hM ) for COST 231 Hata model according to city size. Frequency (MHz) City size 150-1500 Small-medium 150-300 Large 300-2000 Large a(hM ) (dB) f M − 0.7 h1m − 1.56log 1MfHz + 0.8 1M Hz 2 M − 1.1 8.29 log 1.54h 1m 11.75h 2 M 1.1 log 3.2 log 1m − 4.97 And an additional parameter CM is added to take into account city size, and can be summarized for both models, as shown in Table 6.4. 222 WIRELESS NETWORK SIMULATION USING MATLAB Table 6.4 Values of CM for COST 231 Hata model according to city size. Accurate estimations are constrained for separations as well as tower statures which are utilized to infer the model; subsequently, it is typically limited, and the status is given below: Base station reception apparatus tallness from thirty to two hundred meters: Mobile stature: One to ten meters Cell extend: One to twenty kilometers 6.1.9 COST 231-Walfish-Ikegami Model This model has updated the COST wander into a COST 231-Walfisch-Ikegami model [1-3]. It is based on considerations of reflection and scattering above and between buildings in urban environments. It considers both line of sight (LOS) and non-lineof-sight (NLOS) situations. It is designed for 800 MHz to 2 GHz, base station heights of 4 to 50 m, and cell sizes up to 5 km, and is especially convenient for predictions in urban corridors. The case of line of sight is approximated by a model using free-space approximation up to 20 m and the following beyond: LLOS = 42.6 + 26log d 1km + 20log f 1M Hz f or d ≥ 20m (6.28) The model for non-viewable pathway considers different dispersing and diffraction properties of the encompassing structures: LN LOS = L0 + max {0, Lrts + Lmsd } (6.29) where, L0 is free space odd; Lrts is diffraction and diffusion from housetop-to-road redress factor; and Lmsd is multi-screen diffraction. RADIO PROPAGATION FOR SHADOWING METHODS Table 6.5 223 Values for COST 231 Walfish-Ikegami model. Figure 6.12 Demonstration of street orientation angle ϕ for use in COST 231 WalfishIkegami model. The model is typically limited to: Cell run: 0.2 to five kilometers Base station radio wire tallness: Four to fifty meters Frequency: Eight Hundred to two thousand MHz Mobile stature: One to three meters 224 WIRELESS NETWORK SIMULATION USING MATLAB 6.1.10 Erceg Model Only in most of the proposed systems, a model is obtained from a large proportion at 1.9 GHz of data. The model uses 802.16 examinations accumulation as well, which is noticeable with WiMAX suppliers: d L = L0 + 10γlog (6.30) + s f or d ≥ d0 d0 where free space approximation is used for d < d0 . Values for L0 , γ, and s are defined in Tables 6.6 and 6.7. Table 6.6 Table 6.7 Values for Erceg model. Values for Erceg model parameters in various terrain categories. The model is generally confined to: Cell range: 0.1 to eight kilometers Base station antenna height: Ten to eighty meters Frequency: Eight hundred to three thousand seven hundred MHz Mobile stature: Two meters The model is particularly interesting as it provides more than a median estimate for path loss; it also gives a measure of its variation about that median value in terms of three zero-mean Gaussian random variables of variance 1 (x, y, and z = N (0, 1)). RADIO PROPAGATION FOR SHADOWING METHODS 6.1.11 225 Multiple Slope Models Advance refinements are numerous odd types (n1 , n2 ) which are utilized at various reaches to give a few changes, particularly insubstantial multipath inside conditions. For open-air proliferation, two slants are now and then utilized: one close free-space for close focuses, and another observationally decided. Indeed, the approximation of two inclines shown for two-beam model is given as n1 = 2, n2 = 4 for separations, which is more noteworthy when compared with 4hλt hr . Here, it appears that varieties from site to site for the most part are to such an extent that these different slant enhancements are genuinely small, and basic oneslant models are generally a fair first estimate. Still, it requires high performance. So, they need other endeavors as well as particular site territory otherwise building information [14]. 6.1.11.1 In-building This induction method should be frequently surveyed by models which include improvement in the material, divider thickness as well as rooftop material, each of which emphatically influences wave controlling inside the building. A couple of models just assessed the number of dividers and floors with an ordinary incident for each [24-27]. The relative model for In-building condition is the Motley-Keenan model, which checks all the route errors among transmitter and authority and includes substance incident to the extent divider diminishing elements (Fwall ) and debilitating floor segments (Ff loor ). d LdB = L0 + 20log (6.31) + τwall Fwall + τf loor Ff loor d0 Wall attenuation factors vary greatly, typically 10 to 20dB (see Table 6.8); and those for the elements of floor weakening are accounted for differing somewhere in the range of 10 and 40dB, depending on buildings. This model is very site specific, yet sometimes imprecise, as it does not take into account proximity of windows external walls, etc; but it can be useful as a guideline to estimate signal strength to different rooms, suites, and floors in buildings. 6.1.11.2 Frequency Variations Frequency of operations impacts propagation and path loss estimates. As many models are built on cellular or PCS data measurements, one must be careful about extending them to other frequency ranges. Test confirmation in like manner shows up in any case that repeated extensions are incorporating repeat dependence in f 2.6 (or a 26logf term in dB) as proposed in earlier works. Other basic perspectives provide a vital impact on continuous modification. Spatially arranged assortment gain is increased by the increment of special packet in relation to wavelength [13, 28-34]. 226 6.1.11.3 WIRELESS NETWORK SIMULATION USING MATLAB Foliage Foliage attenuates radio waves and may cause additional variations in high wind conditions. Propagation losses and path loss exponents vary strongly with the position of transmitter with respect to the tree canopy; they also vary with the types and density of foliage, and with seasons. We will report in a later chapter on the impact of foliage for fixed wireless links at 3.5 GHz in a suburban area, as foliage grows from the winter months into the spring. Studies have been published at different frequencies; some identify empirical attenuation statistic with Raleigh, Ricean, or Gaussian variables, others derive excess path loss, or attenuation per meter of vegetation [42, 43]. As a rule of thumb, at frequencies around 1 ot 6 GHz, a single tree causes approximately 10-12 dB attenuation, and typical estimates are 1-2 dB/m attenuation. Deciduous trees in winter cause less attenuation: 0.7-0.9 dB/m. (See Table 6.8.) Table 6.8 Vegetation loss caused by tree foliage reported for various frequencies: single-tree model loss in dB, and dB/m loss. Figure 6.13 Tree foliage attenuation as a function of frequency. RADIO PROPAGATION FOR SHADOWING METHODS 6.1.11.4 227 Additional Modeling Works The above models are in a sense simplistic as they focus on path loss as a function of distance. Although these models work well in large cellular coverage prediction, they are often deemed insufficient for smaller cells such as wireless LANs, especially where multipath is dominant, as in a heavy urban environment or indoor environment. An interesting and important activity around propagation modeling is the COST project (Coopration Europenne dans le Domaine de la Recherche Scientifique et Technique), a European Union Forum for cooperative scientific research that has been useful in focusing efforts and publishing valuable summary reports for wireless communications needs. The additional models are: COST 207: “Digital Land Mobile Radio Communications,” March 1984 September 1988, developed channel model used for GSM [5, 22, 23, 37, 48]; COST 231: “Evolution of Land Mobile Radio (Including Personal) Communications,” April 1989 - April 1996, contributed to the deployment of GSM1800, DECT, HIPERLAN 1 and UMTS, and defined propagation models for IMT2000 frequency bands [3, 4, 36, 47]; COST 259: “Wireless Flexible Personalised Communications,” December 1996 - April 2000, contributed to wireless LAN modeling, and 3GPP channel model [38, 45]; COST 273: “Towards Mobile Broadband Multimedia Communications,” May 2001 - June 2005, which contributed to standardization efforts in 3GPP, UMTS networks, provided channel models for MIMO systems [44]. That work was later continued in the COST 2100 group in particular to provide further MIMO advances for the wireless industry [46]. Finally, new interesting activities of research and modeling are taking place at higher frequencies, in millimeter-wave for mobile use with 5G. 6.1.11.5 Dispersive Models Current working model radio systems make extensive use of various courses among transmitter and recipient, despite having diverse gathering device structures (for instance, MIMO). These structures require more than a way to conduct adversity checks, as mishaps were similar among transmitting as well as tolerating radio wire systems. MIMO systems were in this way significantly more complex; a couple of techniques have been used [44]. IEEE 802.16e and Stanford University Interim (SUI): Created by 802.16 and WiMAX outfitted by the fundamental wide models which consist of captivating multiple path examinations as well as favorable MATLAB amusements. The work is initiated with six common conditions shown by six SUI channel models. One strategy for showing transmission delay (past a fundamental concede spread regard) is to consider a movement of electric impulses, each conceded and diminished. The 228 WIRELESS NETWORK SIMULATION USING MATLAB SUI models portray six distinct sorts of conditions with variable tap delays, Doppler effect, and fading statistics: in that manner the model represents different scenarios: pedestrian/vehicular, urban/suburban/rural, indoor/outdoor, etc. IEEE 802.11n: IEEE undertaking bundle created models for 802.11n [19, 20] for local area network applications at 2.4 GHz and 5 GHz. It focuses around an individual by walking adaptability; the social occasion presents six unmistakable models (named A to F) for delineating normal LAN circumstances, generally with fundamentally more multipath than various outside cell conditions. Table 6.9 TGn channel models A to F are used to model MIMO systems in a different environment, with different RMS delay spreads. Table 6.10 TGn channel models A to F use two slopes n1 = 2 near transmitter and different values of n2 beyond a critical distance d0 . 3GPP spatial channel model (SCM) [38]: This is based on 3G and 4G applications, such as Universal Mobile Telecommunication System and Long-Term Evolution, for five MHz channels around two GHz. A few other remarkable models exist, in light of condition, speed, etc., ordinarily showing N deferred multiple paths; each include M subpaths (for normal urban, rustic circumstances, the model works with the values of N and M, which are declared as N = 6, M = 20). Different parameters are also given for different environments (suburban macrocell, urban macrocell, and urban microcell): pathloss (LOS and NLOS), antenna beamwidth, delay statistics, log-normal shadowing, angles of arrival distribution, etc. Basic work on the connection between these distinctive ways is similarly displayed; which is a basic procedure for assessing of the MIMO rank fundamental for structure confine. This model is a splendid wellspring for various diverse parameters and is commonly regarded as supportive to a great degree for any inciting parts of spread for convenient correspondence structures. RADIO PROPAGATION FOR SHADOWING METHODS 6.1.11.6 229 In-Building Penetration Sending RF signal into buildings means additional building penetration loss in the link budget. Indoor penetration measurements are difficult to perform, and difficult to compare from one experiment to another. Difficulties arise mostly from the fact that indoor and outdoor environments are so different that the method of data collection may cause large variations between the two environments; the following parameters have an influence: antenna beamwidth, angle of incidence, outside multipath, indoor multipath, distance from the walls, etc [17, 18, 22]. Measurement campaigns show that the distribution of building penetration loss is close to log-normal, a Gaussian function is a good approximation of the cumulative distribution function (CDF) of indoor measurements. The mean μi and standard deviation σi of indoor penetration loss vary with frequency, types of homes, and environment around the homes. Variations also depend on the location within the building (near an outside wall, a window, or further inside). Finally, the angle of incidence with the outside wall also has a significant impact. With that in mind, we can consider that wireless systems with in-building penetration have a shadowing statistic with a log-normal random variate which combines two independent log-normal variates: the outdoor shadowing and the in-building loss (with standard deviation σi ). And the aggregate random variate is also log-normal distributed, and has a standard deviation σ = σ02 + σi2 (6.32) 6.1.11.7 In-Building Models The COST project proposes models for indoor penetration with variations of angle of incidence [36]. The COST 231 indoor model simply uses a line-of-sight path loss with an indoor component: LdB = 32.4 + 20logfGHz + 20log(S + d) + Lindoor (6.33) where, S is outdoor path, d is indoor path, and Lindoor = Le + Lge (1 − sinθ)2 + max(Γ1 , Γ2 ) (6.34) where, Le is typical rate first divider entrance; the next term represents the added loss due to angle of incidence θ and is sometimes measured over an average of empirical values of incidence, in which case it may be noted Lge = Lge (1 − sinθ)2 ; and the last term max(Γ1 , Γ2 ) aims at estimating loss within the building, whether going through walls or in a corridor. Since angles of incidence are not always known, the estimate Lge = Lge (1 − sinθ)2 is sometimes more convenient. As a rough estimate for angles of incidence between − π2 and π2 lead to the following: Lge = π/2 −π/2 Lge (1 − sinθ)2 dθ ≈ 0.55Lge (6.35) 230 WIRELESS NETWORK SIMULATION USING MATLAB Test estimations of Lge are represented to be ≈ 5.7−6.4 for nearby areas; we may likewise use Lge ≈ 10dB. For urban conditions, COST-231 reports Lge ≈ 20dB. As for help inside a error, the COST perceives spread through dividers and multiplication down corridors. Through ni inside dividers of adversity Li each: Γ1 = ni Li (6.36) Gamma2 = α(d − 2)(1 − sinθ)2 (6.37) In a foyer: with an observational expansion adversity α = 0.6dB/m. Figure 6.14 Table 6.11 COST-231 indoor penetration loss model. Building penetration loss from COST-231 model. Mean, and SD of passageway incident changes concerning repeat, sorts, as well as the home condition. Assortments depend on zone inside the working. In the end, the principal purpose for events was outside divider, which is included; moreover it contains the basic impact. From that perspective, the in-building invasion is logcommonplace self-assertive variants self-governing of large scale shadowing. Like this, log-commonplace obscuring which utilizes indoor expansion must be standard self-assertive variable N. In cooperation the centers’ passage incident, which changed wealth edge, should be considered in favor of another indoor association spending plan. RADIO PROPAGATION FOR SHADOWING METHODS Figure 6.15 6.1.11.8 231 Penetration odd into private structures, total thickness dispersion. Residential Homes In the maximum of private as well as provincial circumstances, surfaces included were for the most part prepared by the glass, squares, wood, plus drywall. The process of penetration is consistently coursing through windows with housetops; adversity is short and also keeps running up with repeat. Precise characterization of in-building penetration is difficult, a rough approximation of an average penetration loss i around 10 to 15 dB and a standard deviation i around 6 dB seems to be the norm in published studies. Table 6.12 Private structures penetration loss: middle odd (μi ) and standard deviation (σi ) from exploratory outcomes announced for different frequencies. 232 WIRELESS NETWORK SIMULATION USING MATLAB Figure 6.16 In-building loss for residential buildings: measurement campaigns published for different frequencies, in different residential areas. 6.1.11.9 Urban Environments Urban zones [3, 36, 49, 50] tests demonstrate distinctive patterns, as shown in Figure 6.17; a few sections indicate infiltration odd expanding with recurrence, some claim odd is autonomous from recurrence, others demonstrate a reduction with recurrence. Figure 6.17 In-building loss for urban office buildings and high-rises: measurement campaigns published for different frequencies, in different urban areas. Way odd models are utilized to figure the decline in the influence of a radio signal as it proliferates far from the transmitter. The default strange way to display in INET is strange, which registers constriction as per the reverse square law along a separate viewable pathway proliferation way. This is a basic model, and reasonable only in specific cases, e.g., when displaying satellite-to-satellite interchanges. As a result of its low computational cost, it is additionally helpful if the accentuation of the recreation is not on the precision of radio proliferation (e.g., for testing conventions). Here is a rundown of those highlighted in this featured case: RADIO PROPAGATION FOR SHADOWING METHODS 233 Table 6.13 Penetration loss into vehicles: median loss (μv ) and standard deviation (σv ) from experimental results reported at various frequencies. Free Space Path Loss: Computes loss of signal control in a solitary observable pathway engendering way, with no reflections or shadowing. Two-Ray Ground Reflections: Computes loss of signal control by expecting an observable pathway wave meddling with another wave reflected starting from the earliest stage of the transmitter and the collector. This model registers impedance in the far-field and is the same as free free-space odd up until the point of a specific hybrid separation. Two-Ray Interferences: This model is the same as the two-beam ground reflection shown in the far-field, yet it displays the impedance of the two waves in the close field too. Rician Fading: It is a stochastic way of displaying misfortune which expects an overwhelming observable pathway signal and different reflected signals between the transmitter and the collector. It helps display radio spread in a public domain. Log-Normal Shadowing: It is a stochastic way of displaying misfortune, where influence levels take after a lognormal circulation. It helps demonstrate shadowing caused by items, for example, trees. 234 WIRELESS NETWORK SIMULATION USING MATLAB 6.2 Mobility: Arbitrary Waypoint Demonstrates In versatility administration, the arbitrary waypoint show is an irregular model for the development of portable clients, and how their area, speed, and quickening change over time. Mobility models are utilized for recreation purposes when new system conventions are assessed. The irregular waypoint display was first proposed by Johnson and Maltz. In arbitrarily based versatility reenactment models, the portable hubs move arbitrarily and openly without limitations. To be more precise, the goal, speed, and heading are altogether picked haphazardly and freely of different hubs. This sort of model has been utilized in numerous reenactments [9, 10, 51-62]. 6.2.1 Random Waypoint Model The random waypoint (RWP) model will be a regularly utilized complete design with extensive versatility, e.g., in ad hoc arranges. It is a rudimentary replica that portrays the development example of freehubs using straightforward stipulations. Figure 6.18 Random waypoint model. In quick succession, during the RWP demonstrate: All hubs move in crisscross procession, starting with one waypoint Pi then on to the subsequent Pi + 1. The waypoints are consistently appropriated over the given curved zone, e.g., unit circle. By the side of the starting, the discretionary speed of each leg is squeezed as of the speed transport (in the fundamental condition the speed is consistent 1). We have the chance to imply “thinking times” by using hubs at the time of achieving every waypoint earlier and then proceeding on to the next leg, where spans are autonomous as well as indistinguishably appropriated arbitrary factors. PHY: SNR-BASED BUNDLE CATCHES, COMMUNICATION, DYNAMIC TRANSMISSION RATE AND POWER 6.2.2 235 Regular Problems with Random Waypoint Model Zig-zag directions: RWP show is basic just as it is definitely not muddled toward fighting with respect to the ways of unnatural life form. Of course, whichever other pragmatic convention system ought to be powerful and give a sensible execution during an extensive variety of moving examples, including development like RWP show. Velocity dissemination: The most broadly perceived issue with proliferation considers using unpredictable waypoint exhibit to be a sad choice of speed allotment, for example, same movement U (0, Vmax ). Those velocity motions describe a scenario wherever each center point stops moving. Keeping in mind the end goal to maintain a strategic distance from this, the speed circulation ought to have the end goal of 1 >0 E[I/V ] 6.2.3 (6.38) Irregular Waypoint on the Border (RWPB) More than the given space, the standard RWP shows that the waypoints are reliably scattered. Then again, the waypoints know how to be reliably scattered on top of the edge and the above design is suggested as the random waypoint on the border (RWPB) model. The dimensional center thickness occurring in light of the RWPB model is extremely novel in connection to the RWP design, i.e., the possible group developments as of the point of convergence of the zone towards the edges. 6.2.4 Markovian Waypoint Model The RWP design is capable of further comprehensive design, for instance,via granting the accompanying waypoint revolving around the present waypoint. The mentioned prompts an assumed Markovian waypoint model (MWP) solitary everywhere could be able to similarly portray support depending on speed spreads (velocity from P1 to P2 is no longer i.i.d. random variable but depends on P1 and P2 ) as well as discretionary intrusion period in the midst of the change between two waypoints [35, 59, 69]. 6.3 PHY: SNR-Based Bundle Catches, Communication, Dynamic Transmission Rate and Power Inconvenient uncommonly designated frameworks, correspondence among flexible center points, occurs through remote medium designed according to off-the-cuff framework tradition. Generally, a standard “layered approach” perspective has been found inadequate to oversee getting signal quality (RSS)-related issues, impacting the physical layer, the framework layer, and transport layer. A layout approach is proposed which diverges from the standard framework plan, toward updating the crosslayer joint effort among different layers, particularly physical, MAC and framework. 236 WIRELESS NETWORK SIMULATION USING MATLAB The Cross-Layer setup approach for Power control (CLPC) enhances the transmission control by averaging the RSS regards and finding a convincing course between the source and the objective. This cross-layer arrangement approach was attempted by reenactment (NS2 test framework) and its execution over AODV was seen as better. 6.3.1 MAC: IEEE 802.11 This approach is especially essential for remote systems, where the impact location of the option CSMA/CD is temperamental because of the concealed hub problem [12, 39-41]. Figure 6.19 MAC layers in IEEE 802.11 standard. CSMA/CA is a convention used for working in the data link layer (Layer 2) of the OSI display. To upgrade the execution of CSMA technique, effect evading is used to through endeavor to isolate the feed, in the same way we perform during all broadcast center points inside the crash space. Carrier Sense: At the initial stage, a center checks the reasonable standard before broadcast (e.g., tuning in intended for secluded signals in a remote framework) to choose if an added center is transmitting or not. Collision Avoidance: An additional middle point was heard, we collect unbending meant for a time allotment (on behalf of the most part sporadic) in favor of the center to discontinue pass on going before focusing again on utilizing for a without charge trades channel. Request to Send/Clear to Send (RTS/CTS): This currently may be used in the direction of arbitrating path to the normal intermediate. To manage making a difference, the issue secured focus focuses on the enlightenment of the truth as well, for example, in a remote structure; the Contact Point presently issues a Clear to Send message towards the individual center points at some random minute. PHY: SNR-BASED BUNDLE CATCHES, COMMUNICATION, DYNAMIC TRANSMISSION RATE AND POWER 237 Transmission: The intermediate is recognized since individuals obvious before the center point acquire a CTS to demonstrate its ability to unequivocally send the packaging. Unlike CSMA/CD, it is to a great degree striving for a remote center to tune while broadcasting (its communication resolve dominates some undertakings regarding inside adjustment). Continuing with the isolated representation, the center envisions acceptance of a affirmation partitions the Contact Point to set up the bundle to be received just as final generated output. In the event that such requests don’t interface with positive access, it looks forward a little additional transmission pounded to the package, influencing the center to go through a period of twofold exponential backoff prior to attempting to re-transmit. 6.3.2 IEEE 802.11 RTS/CTS Exchange CSMA/CA is capable of surviving enhancement as a result of exchanging a Request to Send (RTS) divide through the sender S, as well as Clear to Send (CTS) package sent through the normal authority R; thus forewarning every center point inside extent of the sender, gatherer or else together, in the direction of not broadcast intended for the range of rule communication. The range of rule is identified the same as the IEEE 802.11 RTS/CTS swap. Utilization of RTS/CTS serves to handle the generally hid center issue so as to establish in remote networking as frequently as possible [8, 9]. Figure 6.20 RTS/CTS mechanism. CSMA/CA execution has been developed, upon the secondhand control framework for broadcasting the information stuck between center points. Revise explain to facilitate beneath perfect causing conditions (reenactments), organized a course of action spread range (DSSS) gives the most amazing throughput to all center points on a framework when used in relation to CSMA/CA as well as the IEEE 802.11 RTS/CTS switch over below illumination framework stack circumstances. Frequency Hopping Spread Spectrum (FHSS) in a roundabout way takes after DSSS concerning throughput with a more important throughput once organized stack ends up being impressively generous. 238 WIRELESS NETWORK SIMULATION USING MATLAB G-NET is an early select LAN which offers traditional routing. Apple’s Local Talk executed CSMA/CA on an electrical transport using a threebyte jamming signal. 802.11 RTS/CTS executes virtual conveyor identifying using short request to send and clear to send messages for WLANs (802.11 in a general sense relies upon recognizing the physical transporter). IEEE 802.15.4 (wireless PAN) uses CSMA/CA. NCR WaveLAN is an early prohibitive remote framework. HomePNA. Bus topology. The ITU-T G.hn standard enables high speed networking in the home using existing home wiring (electrical links, phone lines and coaxial connectors). It uses CSMA/CA as a station to obtain procedures for streaming that don’t require guaranteed quality of service, specifically the CSMA/CARP variant. 6.4 NET: Ad Hoc Routing An uncommonly delegated coordinating institution is a conference, otherwise standard, which controls how center points make a choice of which mode toward minimized among course dispenses enrolling contraptions in an adaptable without any preparation structure. Note that in a progressively wide sense, particularly named custom can in like way be utilized truly, towards implied for an impromptu just as normally unconstrained convention set up star an exact reason. The going with is a synopsis of a few extraordinarily designated system controlling conventions [63, 66-68, 70-90]. The accompanying guidelines are a lot of considers: 1. The respective proportion of data for help. 2. Slow reaction on revamping and dissatisfactions. Instances of proactive estimations are: Optimized Link State Routing Protocol (OLSR) RFC 3626, RFC 7181 [11, 71] Babel RFC 6126 [70] Destination Sequenced Distance Vector (DSDV) [85] Distance Routing Effect Algorithm for Mobility (DREAM) [87] Better Approach To Mobile Adhoc Networking (B.A.T.M.A.N) [88] NET: AD HOC ROUTING Figure 6.21 239 Ad hoc routing protocols. These sorts of protocols find an on-demand course by flooding the framework with Route Request groups. The major disadvantages of such computations are: 1. High latency time in course finding. 2. Excessive flooding can incite framework seizing up. Instances of on-demand for computations are: ABR: Associativity-Based Routing [76] Ad hoc On-Demand for Distance Vector (AODV)(RFC 3561) [77] Dynamic Source Routing (RFC 4728) [75] Flow State in the Dynamic Source Routing [74] Power-Aware DSR-Based Routing [90] Alternatives to these techniques entail predetermination for average conditions. The key downsides of such estimations are: 1. Advantages are an endless supply of various center points, started. 2. Reaction to action demands for an endless supply of development volume. Instances of fusion counts: ZRP (Zone Routing Protocol) [6]. It uses IARP as an expert, dynamic, and IERP as a responsive fragment. ZHLS (Zone-Based Hierarchical Link State Routing Protocol) [11]. The critical drawbacks of such computations are: Response of the motion request to the traverse segment limitation. 240 WIRELESS NETWORK SIMULATION USING MATLAB 6.4.1 Dynamic Destination Sequenced Distance Vector The Destination-Sequenced Distance-Vector (DSDV) routing algorithm is based on the idea of the classical Bellman-Ford routing algorithm with certain improvements [72, 73]. Every mobile station maintains a routing table that lists all available destinations, the number of hops to reach the destination and the sequence number assigned by the destination node. The sequence number is used to distinguish stale routes from new ones and thus avoid the formation of loops. The stations periodically transmit their routing tables to their immediate neighbors. A station also transmits its routing table if a significant change has occurred in its table from the last update sent. So, the update is both time-driven and event-driven. The routing table updates can be sent in two ways: a “full dump” or an incremental update. A full dump sends the full routing table to the neighbors and could span many packets whereas in an incremental update only those entries from the routing table are sent that have a metric change since the last update and they must fit in a packet. If there is space in the incremental update packet then those entries may be included whose sequence number has changed. When the network is relatively stable, incremental updates are sent to avoid extra traffic and full dumps are relatively infrequent. In a fast-changing network, incremental packets can grow large so full dumps will be more frequent. Each route update packet, in addition to the routing table information, also contains a unique sequence number assigned by the transmitter. The route labeled with the highest (i.e., most recent) sequence number is used. If two routes have the same sequence number then the route with the best metric (i.e., shortest route) is used. Based on the past history, the stations estimate the settling time of routes. The stations delay the transmission of a routing update by settling time so as to eliminate those updates that would occur if a better route was to be found very soon. Figure 6.22 Example of distance vector routing. NET: AD HOC ROUTING 241 Distance Vector Routing algorithm sample code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 %.................................................................. % Distance Vector Routing algorithm %.................................................................. clc; clear all; disp(’Distance vector routing protocol’); node=input(’Enter the no. of nodes: ’); over=0; %.................................................................. %initialize %.................................................................. for i=1:node for j=i:node if(i==j) matrix(i,j)=0; else matrix(i,j)=randint(1,1,9); matrix(j,i)=matrix(i,j); end end end disp(matrix); i=1; x=1; mat1=triu(matrix); for i=1:node for j=1:node if(mat1(i,j)˜=0) mat(i,j)=x; mat(j,i)=mat(i,j); x=x+1; end end end view(biograph(triu(matrix),[],’showarrows’,’off’,’ShowWeights’, ’on’,’EdgeTextColor’,[0 0 1])); %.................................................................. % fill initial matrix with via = to %.................................................................. for from=1:node for via=1:node for to=1:node if(from˜=via&&from˜=to) if(via==to&&matrix(from,to)˜=0) go(to,via,from)=matrix(from,to); else go(to,via,from)=100; end else go(to,via,from)=inf; end end end 242 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 WIRELESS NETWORK SIMULATION USING MATLAB end i=0; while(i<2) for from=1:node for to=1:node if(from˜=to) %.................................................................. % calculate neighbour node %.................................................................. if(matrix(from,to)˜=0) for x=1:node for y=1:node temp(x,y)=matrix(from,to)+min(go(y,:,to)); if(temp(x,y)<go(y,to,from)&&go(y,to,from)<inf) go(y,to,from)=temp(x,y); end end end end end end end i=i+1; end disp(go); choice=’y’; while(choice==’y’) source=input(’Enter the source node: ’); dest=input(’Enter the destination node: ’); trace(1)=source; j=2; while(source˜=dest) [row,col]=find(go(dest,:,source)==min(go(dest,:,source))); trace(j)=col; source=col; j=j+1; end k=1:j-1; disp(trace(k)); bg=biograph(triu(matrix),[],’showarrows’,’off’,’ShowWeights’,’on’, ’EdgeTextColor’,[0 0 1]); for i=1:j-1 set(bg.nodes(trace(i)), ’color’, [1 0 0]); set(bg.nodes(trace(1)),’color’,[0 1 0]); if(i<j-1) set(bg.edges(mat(trace(i+1),trace(i))),’linecolor’,[1 0 0]); end end view(bg); choice=input(’Do you want to try again (y/n):’,’s’); end NET: AD HOC ROUTING 6.4.2 243 Wireless Routing Protocol The wireless routing protocol (WRP) [74-86] is a table-based distance-vector routing protocol. Each node in the network maintains a Distance table, a Routing table, a Link-Cost table and a Message Retransmission list. The distance table of a node x contains the distance of each destination node y via each neighbor z of x. It also contains the downstream neighbor of z through which this path is realized. The Routing table of node x contains the distance of each destination node y from node x, the predecessor and the successor of node x on this path. It also contains a tag to identify if the entry is a simple path, a loop or invalid. Storing predecessor and successor in the table is beneficial in detecting loops and avoiding counting-to-infinity problems. The link-cost table contains cost of link to each neighbor of the node and the number of timeouts since an error-free message was received from that neighbor. The message retransmission list (MRL) contains information to let a node know which of its neighbors has not acknowledged its update message in order to retransmit the update message to that neighbor. Node exchange routing tables with their neighbors use update messages periodically as well as on link changes. The nodes present on the response list of update message (formed using MRL) are required to acknowledge the receipt of update message. If there is no change in routing table since last update, the node is required to send an idle Hello message to ensure connectivity. On receiving an update message, the node modifies its distance table and looks for better paths using new information. Any new path so found is relayed back to the original nodes so that they can update their tables. The node also updates its routing table if the new path is better than the existing path. On receiving an ACK, the mode updates its MRL. A unique feature of this algorithm is that it checks the consistency of all its neighbors every time it detects a change in link of any of its neighbors. Consistency check in this manner helps eliminate looping situations in a better way and also has fast convergence. 6.4.3 Global State Routing Global state routing (GSR) [81] is similar to DSDV. It takes the idea of link state routing but improves it by avoiding flooding of routing messages. In this algorithm, each node maintains a neighbor list, a topology table, a Next Hop table and a Distance table. The neighbor list of a node contains the list of its neighbors (here all nodes that can be heard by a node are assumed to be its neighbors.). For each destination node, the topology table contains the link state information as reported by the destination and the timestamp of the information. For each destination, the Next Hop table contains the next hop to which the packets for this destination must be forwarded. The distance table contains the shortest distance to each destination node. The routing messages are generated on a link change as in link state protocols. On receiving a routing message, the node updates its topology table if the sequence number of the message is newer than the sequence number stored in the table. After this the node reconstructs its routing table and broadcasts the information to its neighbors. 244 WIRELESS NETWORK SIMULATION USING MATLAB 6.4.4 Fisheye State Routing Fisheye state routing (FSR) is an improvement of GSR [82]. The large size of update messages in GSR wastes a considerable amount of network bandwidth. In FSR, each update message does not contain information about all nodes. Instead, it exchanges information about closer nodes more frequently than it does about farther nodes, thus reducing the update message size. So each node gets accurate information about neighbors and the detail and accuracy of information decreases as the distance from node increases. Figure 6.23 defines the scope of fisheye for the center (red) node. The scope is defined in terms of the nodes that can be reached in a certain number of hops. The center node has most accurate information about all nodes in the white circle and so on. Even though a node does not have accurate information about distant nodes, the packets are routed correctly because the route information becomes more and more accurate as the packet moves closer to the destination. FSR scales well to large networks as the overhead is controlled in this scheme. Figure 6.23 6.4.5 Accuracy of information in FSR. Hierarchical State Routing The characteristic feature of hierarchical state routing (HSR) [89] is multilevel clustering and logical partitioning of mobile nodes. The network is partitioned into clusters and a cluster-head elected as in a cluster-based algorithm. In HSR, the clusterheads again organize themselves into clusters and so on. The nodes of a physical cluster broadcast their link information to each other. The cluster-head summarizes its cluster’s information and sends it to neighboring cluster-heads via gateway. As shown in the Figure 6.24, these cluster-heads are members of the cluster on a level higher and they exchange their link information as well as the summarized lower-level information among each other and so on. A node at each level floods to its lower level the information that it obtains after the algorithm has run at that level. So the lower level has a hierarchical topology information. Each node has a hierarchical address. One way to assign hierarchical address is the cluster numbers NET: AD HOC ROUTING 245 on the way from root to the node as, shown in Figure 6.24. A gateway can be reached from the root via more than one path, so gateway can have more than one hierarchical address. A hierarchical address is enough to ensure delivery from anywhere in the network to the host. Figure 6.24 An example of clustering in HSR. In addition, nodes are also partitioned into logical subnetworks and each node is assigned a logical address <subnet, host>. Each subnetwork has a location management server (LMS). All the nodes of that subnet register their logical address with the LMS. The LMS advertise their hierarchical address to the top levels and the information is sent down to all LMS too. The transport layer sends a packet to the network layer with the logical address of the destination. The network layer finds the hierarchical address of the hierarchical address of the destination LMS from its LMS and then sends the packet to it. The destinations LMS forwards the packet to the destination. Once the source and destination know each other hierarchical addresses, they can bypass the LMS and communicate directly. Since logical address/hierarchical address is used for routing, it is adaptable to network changes. 6.4.6 Zone-Based Hierarchical Link State Routing Protocol In zone-based hierarchical link state routing protocol (ZHLS) [11, 71], the network is divided into non-overlapping zones. Unlike other hierarchical protocols, there is no zone-head. ZHLS defines two levels of topologies: node level and zone level. A node level topology tells how nodes of a zone are connected to each other physically. A virtual link between two zones exists if at least one node of a zone is physically connected to some node of the other zone. Zone level topology tells how zones are 246 WIRELESS NETWORK SIMULATION USING MATLAB connected together. There are two types of link state packets (LSP) as well: node LSP and zone LSP. A node LSP of a node contains its neighbor node information and is propagated with the zone whereas a zone LSP contains the zone information and is propagated globally. So each node has full node connectivity knowledge about the nodes in its zone and only zone connectivity information about other zones in the network. So given the zone id and the node id of a destination, the packet is routed based on the zone id till it reaches the correct zone. Then, in that zone, it is routed based on node id. A <zone id, node id@gt> of the destination is sufficient for routing so it is adaptable to changing topologies. 6.4.7 Clusterhead Gateway Switch Routing Protocol Clusterhead gateway switch routing (CGSR) [86] uses as its basis the DSDV Routing algorithm described in the previous section. The mobile nodes are aggregated into clusters and a cluster-head is elected. All nodes that are in the communication range of the cluster-head belong to its cluster. A gateway node is a node that is in the communication range of two or more cluster-heads. A dynamic network cluster-head scheme can cause performance degradation due to frequent cluster-head elections, so CGSR uses a least cluster change (LCC) algorithm. In LCC, cluster-head change occurs only if a change in network causes two cluster-heads to come into one cluster or one of the nodes moves out of the range of all the cluster-heads. The general algorithm works in the following manner. The source of the packet transmits the packet to its cluster-head. From this cluster-head, the packet is sent to the gateway node that connects this cluster-head and the next cluster-head along the route to the destination. The gateway sends it to that cluster-head and so on till the destination cluster-head is reached in this way. The destination cluster-head then transmits the packet to the destination. Figure 6.25 shows an example of CGSR routing scheme. Figure 6.25 Example of CGSR routing from node 1 to node 12. NET: AD HOC ROUTING 247 Each node maintains a cluster member table that has mapping from each node to its respective cluster-head. Each node broadcasts its cluster member table periodically and updates its table after receiving other node broadcasts using the DSDV algorithm. In addition, each node also maintains a routing table that determines the next hop to reach the destination cluster. On receiving a packet, a node finds the nearest cluster-head along the route to the destination according to the cluster member table and the routing table. Then it consults its routing table to find the next hop in order to reach the cluster-head selected in step one and transmits the packet to that node. 6.4.8 Cluster-Based Routing Protocols In cluster-based routing protocol (CBRP) [72], the nodes are divided into clusters. To form the cluster the following algorithm is used. When a node comes up, it enters the “undecided” state, starts a timer and broadcasts a Hello message. When a clusterhead gets this hello message it responds with a triggered hello message immediately. When the undecided node gets this message it sets its state to “member.” If the undecided node times out, then it makes itself the cluster-head if it has bi-directional link to some neighbor, otherwise it remains in undecided state and repeats the procedure again. Clusterheads are changed as infrequently as possible. Each node maintains a neighbor table. For each neighbor, the neighbor table of a node contains the status of the link (uni- or bi-directional) and the state of the neighbor (cluster-head or member). A cluster-head keeps information about the members of its cluster and also maintains a cluster adjacency table that contains information about the neighboring clusters. For each neighbor cluster, the table has an entry that contains the gateway through which the cluster can be reached and the cluster-head of the cluster. Figure 6.26 Example of CBRP protocol. 248 WIRELESS NETWORK SIMULATION USING MATLAB When a source has to send data to a destination, it floods route request packets (but only to the neighboring cluster-heads). On receiving the request a cluster-head checks to see if the destination is in its cluster. If yes, then it sends the request directly to the destination or else it sends it to all its adjacent cluster-heads. The cluster-heads address is recorded in the packet so a cluster-head discards a request packet that it has already seen. When the destination receives the request packet, it replies back with the route that had been recorded in the request packet. If the source does not receive a reply within a time period, it backs off exponentially before trying to send route request again. In CBRP, routing is done using source routing. It also uses route shortening, that is, on receiving a source route packet, the node tries to find the farthest node in the route that is its neighbor (this could have happened due to a topology change) and sends the packet to that node, thus reducing the route. While forwarding the packet if a node detects a broken link it sends back an error message to the source and then uses local repair mechanism. In local repair mechanism, when a node finds the next hop is unreachable, it checks to see if the next hop can be reached through any of its neighbors or if hop after next hop can be reached through any other neighbor. If any of the two works, the packet can be sent out over the repaired path. 6.4.9 Ad Hoc On-Demand Distance Vector Routing Ad hoc on-demand distance vector routing (AODV) is an improvement on the DSDV algorithm [77]. AODV minimizes the number of broadcasts by creating routes on demand as opposed to DSDV that maintains the list of all the routes. Figure 6.27 Route discovery in AODV. To find a path to the destination, the source broadcasts a route request packet. The neighbors in turn broadcast the packet to their neighbors till it reaches an intermediate node that has recent route information about the destination or till it reaches the destination (Figure 6.27(a)). A node discards a route request packet that it has already seen. The route request packet uses sequence numbers to ensure that the routes are loop free and to make sure that if the intermediate nodes reply to route requests, they reply with the latest information only. NET: AD HOC ROUTING 249 When a node forwards a route request packet to its neighbors, it also records in its tables the node from which the first copy of the request came. This information is used to construct the reverse path for the route reply packet. AODV uses only symmetric links because the route reply packet follows the reverse path of route request packet. As the route reply packet traverses back to the source (Figure 6.27(b)), the nodes along the path enter the forward route into their tables. If the source moves then it can reinitiate route discovery to the destination. If one of the intermediate nodes move then the moved nodes neighbor realizes the link failure and sends a link failure notification to its upstream neighbors and so on till it reaches the source upon which the source can reinitiate route discovery if needed. 6.4.10 Dynamic Source Routing Protocol The dynamic source routing protocol is a source-routed on-demand routing protocol. A node maintains route caches containing the source routes that it is aware of. The node updates entries in the route cache as it learns about new routes [21, 74]. The two major phases of the protocol are: route discovery and route maintenance. When the source node wants to send a packet to a destination, it looks up its route cache to determine if it already contains a route to the destination. If it finds that an unexpired route to the destination exists, then it uses this route to send the packet. But if the node does not have such a route, then it initiates the route discovery process by broadcasting a route request packet. The route request packet contains the address of the source and the destination, and a unique identification number. Each intermediate node checks whether it knows of a route to the destination. If it does not, it appends its address to the route record of the packet and forwards the packet to its neighbors. To limit the number of route requests propagated, a node processes the route request packet only if it has not already seen the packet and its address is not present in the route record of the packet. A route reply is generated when either the destination or an intermediate node with current information about the destination receives the route request packet. A route request packet reaching such a node already contains, in its route record, the sequence of hops taken from the source to this node. Figure 6.28 Creation of record route in DSRP. 250 WIRELESS NETWORK SIMULATION USING MATLAB As the route request packet propagates through the network, the route record is formed as shown in Figure 6.28(a). If the route reply is generated by the destination then it places the route record from the route request packet into the route reply packet. On the other hand, if the node generating the route reply is an intermediate node then it appends its cached route to destination to the route record of route request packet and puts that into the route reply packet. Figure 6.28(b) shows the route reply packet being sent by the destination itself. To send the route reply packet, the responding node must have a route to the source. If it has a route to the source in its route cache, it can use that route. The reverse of route record can be used if symmetric links are supported. In case symmetric links are not supported, the node can initiate route discovery to source and piggyback the route reply on this new route request. DSRP uses two types of packets for route maintenance: route error packet and acknowledgements. When a node encounters a fatal transmission problem at its data link layer, it generates a route error packet. When a node receives a route error packet, it removes the hop in error from its route cache. All routes that contain the hop in error are truncated at that point. Acknowledgment packets are used to verify the correct operation of the route links. This also includes passive acknowledgments in which a node hears the next hop forwarding the packet along the route. 6.4.11 Temporally Ordered Routing Algorithm The temporally ordered routing algorithm (TORA) [67, 74] is a highly adaptive, efficient and scalable distributed routing algorithm based on the concept of link reversal. TORA is proposed for highly dynamic mobile, multihop wireless networks. It is a source-initiated on-demand routing protocol. It finds multiple routes from a source node to a destination node. The main feature of TORA is that the control messages are localized to a very small set of nodes near the occurrence of a topological change. To achieve this, the nodes maintain routing information about adjacent nodes. The protocol has three basic functions: route creation, route maintenance, and route erasure. Each node has a quintuple associated with it: Logical time of a link failure The unique ID of the node that defined the new reference level A reflection indicator bit A propagation ordering parameter The unique ID of the node The first three elements collectively represent the reference level. A new reference level is defined each time a node loses its last downstream link due to a link failure. The last two values define a delta with respect to the reference level. NET: AD HOC ROUTING 251 Route Creation is done using QRY and UPD packets. The route creation algorithm starts with the height (propagation ordering parameter in the quintuple) of destination set to 0 and all other node’s height set to NULL (i.e., undefined). The source broadcasts a QRY packet with the destination node’s id in it. A node with a non-NULL height responds with a UPD packet that has its height in it. A node receiving a UPD packet sets its height to one more than that of the node that generated the UPD. A node with higher height is considered upstream and a node with lower height downstream. In this way a directed acyclic graph is constructed from source to the destination. Figure 6.29 illustrates a route creation process in TORA. As shown in Figure 6.29(a), node 5 does not propagate QRY from node 3 as it has already been seen and propagated QRY message from node 2. In Figure 6.29(b), the source (i.e., node 1) may have received a UPD each from node 2 or node 3 but since node 4 gives it lesser height, it retains that height. Figure 6.29 Example of route creation in TORA. When a node moves the DAG route is broken, and route maintenance is needed to reestablish a DAG for the same destination. When the last downstream link of a node fails, it generates a new reference level. This results in the propagation of that reference level by neighboring nodes, as shown in Figure 6.30. Figure 6.30 Re-establishing route on failure of link 5-7. The new reference level is node 5. 252 WIRELESS NETWORK SIMULATION USING MATLAB Links are reversed to reflect the change in adapting to the new reference level. This has the same effect as reversing the direction of one or more links when a node has no downstream links. In the route erasure phase, TORA floods a broadcast clear packet (CLR) throughout the network to erase invalid routes. In TORA there is a potential for oscillations to occur, especially when multiple sets of coordinating nodes are concurrently detecting partitions, erasing routes, and building new routes based on each other. Because TORA uses internodal coordination, its instability problem is similar to the “count-to-infinity” problem in distance-vector routing protocols, except that such oscillations are temporary and route convergence will ultimately occur. 6.4.12 Associativity-based Routing The associativity-based routing (ABR) protocol is a new approach for routing. ABR defines a new metric for routing known as the degree of association stability [76]. It is free from loops, deadlock, and packet duplicates. In ABR, a route is selected based on associativity states of nodes. The routes thus selected are likely to be long-lived. All nodes generate periodic beacons to signify their existence. When a neighbor node receives a beacon, it updates its associativity tables. For every beacon received, a node increments its associativity tick with respect to the node from which it received the beacon. Association stability means connection stability of one node with respect to another node over time and space. A high value of associativity tick with respect to a node indicates a low state of node mobility, while a low value of associativity tick may indicate a high state of node mobility. Associativity ticks are reset when the neighbors of a node or the node itself move out of proximity. The fundamental objective of ABR is to find longer-lived routes for ad hoc mobile networks. The three phases of ABR are route discovery, route reconstruction (RRC) and route deletion. Figure 6.31 Associativity-based routing. NET: AD HOC ROUTING 253 The route discovery phase is a broadcast query and await-reply (BQ-REPLY) cycle. The source node broadcasts a BQ message in search of nodes that have a route to the destination. A node does not forward a BQ request more than once. On receiving a BQ message, an intermediate node appends its address and its associativity ticks to the query packet. The next succeeding node erases its upstream node neighbors’ associativity tick entries and retains only the entry concerned with itself and its upstream node. Each packet arriving at the destination will contain the associativity ticks of the nodes along the route from source to the destination. The destination can now select the best route by examining the associativity ticks along each of the paths. If multiple paths have the same overall degree of association stability, the route with the minimum number of hops is selected. Once a path has been chosen, the destination sends a REPLY packet back to the source along this path. The nodes on the path that the REPLY packet follows mark their routes as valid. All other routes remain inactive, thus avoiding the chance of duplicate packets arriving at the destination. RRC phase consists of partial route discovery, invalid route erasure, valid route updates, and new route discovery, depending on which node(s) along the route move. Source node movement results in a new BQ-REPLY process because the routing protocol is source-initiated. The route notification (RN) message is used to erase the route entries associated with downstream nodes. When the destination moves, the destination’s immediate upstream node erases its route. A localized query (LQ [H]) process, where H refers to the hop count from the upstream node to the destination, is initiated to determine if the node is still reachable. If the destination receives the LQ packet, it selects the best partial route and REPLYs; otherwise, the initiating node times out and backtracks to the next upstream node. An RN message is sent to the next upstream node to erase the invalid route and inform this node that it should invoke the LQ [H] process. If this process results in backtracking more than halfway to the source, the LQ process is discontinued and the source initiates a new BQ process. When a discovered route is no longer needed, the source node initiates a route delete (RD) broadcast. All nodes along the route delete the route entry from their routing tables. The RD message is propagated by a full broadcast, as opposed to a directed broadcast, because the source node may not be aware of any route node changes that occurred during RRCs. 6.4.13 Signal Stability Routing The signal stability-based adaptive routing protocol (SSR) presented is an on-demand routing protocol that selects routes based on the signal strength between nodes and a node’s location stability. This route selection criterion has the effect of choosing routes that have “stronger” connectivity. SSR comprises two cooperative protocols: the dynamic routing protocol (DRP) and the static routing protocol (SRP) [79]. The DRP maintains the signal stability table (SST) and routing table (RT). The SST stores the signal strength of neighboring nodes obtained by periodic beacons from the link layer of each neighboring node. Signal strength is either recorded as a 254 WIRELESS NETWORK SIMULATION USING MATLAB strong or weak channel. All transmissions are received by DRP and processed. After updating the appropriate table entries, the DRP passes the packet to the SRP. The SRP passes the packet up the stack if it is the intended receiver. If not, it looks up the destination in the RT and forwards the packet. If there is no entry for the destination in the RT, it initiates a route-search process to find a route. Routerequest packets are forwarded to the next hop only if they are received over strong channels and have not been previously processed (to avoid looping). The destination chooses the first arriving route-search packet to send back as it is highly likely that the packet arrived over the shortest and/or least congested path. The DRP reverses the selected route and sends a route-reply message back to the initiator of route-request. The DRP of the nodes along the path update their RTs accordingly. Route-search packets arriving at the destination have necessarily arrived on the path of strongest signal stability because the packets arriving over a weak channel are dropped at intermediate nodes. If the source times out before receiving a reply then it changes the PREF field in the header to indicate that weak channels are acceptable, since these may be the only links over which the packet can be propagated. When a link failure is detected within the network, the intermediate nodes send an error message to the source indicating which channel has failed. The source then sends an erase message to notify all nodes of the broken link and initiates a new route-search process to find a new path to the destination. 6.5 6.5.1 APP: Overlay Routing Protocols System/Application Designs, Optimizations, and Implementations on Overlay Networks An overlay is a layer out of virtual structure topology over the physical system, which primarily interfaces with clients. With the quick advancement of the Internet and calculation improvement, on a fundamental level more complete data and asset transactions are accessible from customers or associates than from a predestined number of joined servers. The focal points of overlay systems provide an opportunity for more immediate use of the Internet data and resources [86]. 1. Overlay structures permit the two systems association masters and application clients to reasonably plan and finish their specific correspondence condition and customs over the Internet; for example, information controlling and record sharing association. 2. Data controlling in overlay systems can be astoundingly flexible, rapidly perceiving and evading sort out blockages by adaptively picking courses in the context of various estimations. 3. The end-focuses in overlay structures are primarily associated with each other from the perspective of adaptable coordinating. For whatever timeframe that the physical structure affiliations exist, one end-focus point can pass on to another APP: OVERLAY ROUTING PROTOCOLS 255 end-focus through overlay systems. Along these lines, versatility and quality in overlay structures are two engaging highlights. 4. The high level of openness of consistently more end-focus focuses to join overlay systems empowers productive sharing of a great amount of data and assets open on the Internet. Figure 6.32 An illustrative example of overlay networks. There are a few difficulties and issues regarding overlays that need to be explored. In the first place, overlay structures have no control of physical systems and, furthermore, require central physical structure data. Second, because of the indirect or even mis-correspondences among overlay and underlay structures, in the end, wasteful utilization when dealing with assets occurs every now and again in many overlay applications; for example, mess-ups among overlay and underlay topology, misconstrued results among end-to-end focus by virtue of system parts, sending a lot of excess messages, and others. Third, since the overlay structures are open to a broad assortment of Internet clients, security and confirmation issues can be especially true blue. Fourth, overlay systems are radically decentralized; moreover, they are in all probability going to have a slight point of confinement regarding asset composed endeavors. Finally, the sensibility of advantage sharing and formed undertakings among end-focus focuses on overlay systems are two major issues that have not been completely tended to. In the following sections we will discuss unstructured P2P overlays, organizing overlays for VoIP, and parallel downloading for record overlays. 6.5.2 Routing Overlays for VoIP VoIP applications on overlays have transformed into an ordinary, and fiscally sound option for a few customers [64]. Having driven positive tests to measure Skype’s coordinating cases, we assume that 256 WIRELESS NETWORK SIMULATION USING MATLAB 1. Peer exchanges can significantly improve the VoIP quality in overlay frameworks; and 2. The associate center point assurance procedure for VoIP moves in Skype is not lacking necessary directing information of underlying frameworks. We propose an AS-careful overlay coordinating protocol, called ASAP, to streamline the VoIP execution and to upgrade internet exchange speed use. 6.5.3 Measurement, Modeling, and Improvement of BitTorrent Overlays Our estimations and examination of BitTorrent development give a couple of new revelations concerning the obstacles of BitTorrent structures: 1. Due to the exponentially lessening partner landing rate, when in doubt, advantage availability in such systems ends quickly, after which it is troublesome for the record to be found and downloaded. 2. Client execution in the BitTorrent-like structures is unstable and changes extensively with buddies. 3. Existing systems could give unmerited organizations to peers, where peers with high downloading speed tend to download progressively and exchange less. Our model quantitatively provides a strong motivation for joint exertions as opposed to vitalizing seeds to stay longer. We likewise propose a system to show the likelihood of multi-storm collaboration [65]. 6.5.3.1 Proficient File Searching in Unstructured P2P Overlays Flooding is an essential hunt strategy in unstructured P2P frameworks. It has the benefit of low inactivity and high versatility. In any case, there is producing a considerable measure of system activity. We have proposed a few productive looking strategies with minimal effort while holding the upside of flooding. 6.5.3.2 Namelessness Support in P2P Overlays We have proposed a few namelessness conventions in P2P overlays to secure associates’ protection. A few conventions likewise use an outsider, for example, a supernode or an intermediary, which will likewise guarantee some security worries in P2P interchanges. 6.5.3.3 Topology-Careful Routing and Data Consistency in P2P Overlays We address the issue of topology befuddling the P2P overlay and physical frameworks by proposing a couple of viable and insignificant exertion techniques to adaptively create overlay frameworks for generally organizing the frameworks at the two layers. APP: OVERLAY ROUTING PROTOCOLS 6.5.3.4 ples 257 Building Applications on Overlay Networks and Applying P2P Princi- We have proposed a P2P helped delegate for passing on spouting media. With the assistance of a DHT (sorted out P2P), the spouting mediator ends up adaptable, and its transport quality is high, and the cost is low. Another recommendation is to gather a program’s stable Internet holding structure to thoroughly expand the convincing mediator assess, and to upgrade its ampleness. 6.5.3.5 Structure Virtual or reliable associations relate center point framework, and each one looks on the path, possibly by various physical associations, with the fundamental framework. For example, scattered structures, such as shared frameworks and client-server applications, are overlay frameworks because their center points continue running over the Internet. Figure 6.33 A sample overlay network. The Internet was at first filled in the telephonic model, while today, The phone discovers that the overlay composition is logically changed over the Internet. These frameworks are employed in media transmission from the perspective of the openness of cutting-edge circuit trading gear as well as an optical fiber. Media transmission frameworks plus IP frameworks are out and out overlaid with not as much as an optical fiber layer, a vehicle layer, and IP of different circuit traversing nodes or layer. Figure 6.34 Overlay network broken up into logical layers. 258 WIRELESS NETWORK SIMULATION USING MATLAB From a physical standpoint, the overlay framework is extremely confusing which join unmistakable sensitive layers those which are filled in just as worked by a few substances (affiliations, colleges and so on) at any level they give division of stress after at some stage allows the advancement of a broad course of action of associations proved unable to suggest a performance media transmission supervisor (extendency from broadband Internet get the opportunity to, command, etc.) [2]. 6.5.3.6 Over the Internet The Internet is the backbone of lots and lots of overlaid frameworks which are produced remembering the true objective to enable guiding information to objectives were IP addresses are not dictated. Overlay frameworks have, moreover, dealt with improved Internet coordinating, for instance, from side to side nature of organization affirmations to attain maximum quality spouting media. Alternatively, an overlay framework is increased and passed at the end, which runs the overlay network protocols for programming with the absence of joint effort from ISPs. It has no control over how controls are coordinated in the fundamental framework between two overlay centers, yet it controls, for example, the assembly of overlay center point information crosses earlier than accomplishing its objective. The recent use of overlay networking is in the context of a virtualized network on top of the Internet. In this case, nodes can be set up that act as overlay network routing nodes, where a logical path is set up between any two such nodes over the Internet, for example, using a TCP session. In this case, overlay network nodes are computers that need not be directly connected to a router in the Internet. Since a TCP session is set up between two computers to form a virtual link for the overlay network, any traffic can be transported over this virtual TCP-based link. Not only that, the computers can be used to run their own routing protocol on this overlay network topology. Figure 6.35 Overlay network over the Internet. You may wonder what is the advantage of creating such overlay networks. An important point to note is that routing in the core of the Internet does not change CONCLUSION 259 much in a short duration. In other words, we may assume the routing path to be static in a specific time window. A problem with this is that if there is a failure, it may take a while to recover from the failure. In other words, the network may not be responsive as quickly as you would like it to be. On the other hand, using an overlay network, frequent probes can be generated to learn about a failure as soon as possible, thus, allowing for rerouting using the overlay nodes (see Figure 6.35). As we can see, the core Internet is shown with a number of routers. Then, we list four computers serving as overlay network nodes at the edge of the network, marked as O1 , O2 , O3 , and O4 . Any two of them are connected through a TCP session forming a virtual tunnel/link. We can see that the logical link between O3 and O4 uses the link between routers R2 and R3 . If this physical link fails, O3 and O4 would immediately recognize the failure from the probing module. Then, O4 may route its traffic to O2 to deliver to O3 . Thus, an overlay network may be formed to provide resilience. 6.5.3.7 Quality Resilient overlay network (RON) structures allow distributed internet applications to recognize as well as recover from disconnection or interference. Current wide area routing protocols which take at least several minutes to recover from are improved by this layer overlay. The RON centers screen the internet routes among themselves as well as choose whether to reroute packages. In particular, the usually advantageous RON focuses on the internet have been completed thusly streamlining application specific measurements. It has been ascertained that resilient overlay networks have an acceptable basic layout. RON center points are sent at various zones on the Internet. Each one of the RON centers screen the idea of the Internet courses among each other as well as makes use of this message to correctly choose routes from all bundles, thus decreasing the amount of time required to recuperate from the low nature of the service. 6.5.3.8 Multicast This is generally called Peer-to-Peer Multicast. Multi-source, multicast high information exchange limit between large dispersed centers is an essential capability for a broad assortment of employments, including sound and video conferencing, multiparty preoccupations and substance appointment. Throughout the latest decade, different research wanders have examined the usage of multicasts as a beneficial and flexible framework to help such assembling correspondence applications. 6.6 Conclusion Different kinds of propagations are used in the network modeling, all of which are used and implemented in this chapter. This chapter discussed different kinds of propagations used in the network modeling. Different shadowing methods for the propagation of the network were presented. Among these methods, radio propagation, partition defense, light scale blurring, free space propagation, etc., were the main 260 WIRELESS NETWORK SIMULATION USING MATLAB topics of this chapter. Application examples with sample outputs were given so that students can get a clear idea of the different propagation concepts. This chapter explained the functionality of different mobility waypoints and different aspects of the communication, and the different regular problems we can face with the regular waypoints in network modeling. We further explained the process of different IEEE protocols and their uses in the networking protocols. REFERENCES 1. Ikegami, F., Yoshida, S., Takeuchi, T., & Umehira, M. (1984). Propagation factors controlling mean field strength on urban streets. IEEE Transactions on Antennas and Propagation, 32(8), 822-829. 2. Walfisch, J., & Bertoni, H. L. (1988). A theoretical model of UHF propagation in urban environments. IEEE Transactions on antennas and propagation, 36(12), 1788-1796. 3. COST: Urban transmission loss models for mobile radio in the 900- and 1,800-MHz bands. COST 231 TD (91) 73. 4. Afonso Serralha - http://grow.tecnico.ulisboa.pt/g̃row.daemon/cost231/ 5. Okumura, Y. (1968). Field strength and its variability in VHF and UHF land-mobile radio service. Rev. Electr. Commun. Lab., 16, 825-873. 6. Haas, Z. J., & Pearlman, M. R. (1998). The zone routing protocol (ZRP) for ad hoc networks (Internet-Draft). Mobile Ad-hoc Network (MANET) Working Group, IETF. 7. Hata, M. (1980). Empirical formula for propagation loss in land mobile radio services. IEEE transactions on Vehicular Technology, 29(3), 317-325. 8. Dimitriou, A. G., & Sergiadis, G. D. (2007). Microcellular propagation prediction model based on a geometric progression approximation-process. IEEE transactions on antennas and propagation, 55(3), 969-977. 9. Goldsmith, A. (2005). Wireless communications. Cambridge university press. 10. Bertoni, H. L. (1999). Radio propagation for modern wireless systems. Pearson Education. 11. Takahashi, M., Bandai, M., & Sasase, I. (2005). Multilevel zonebased hierarchical link state routing with location search technique applying hierarchical request for mobile ad hoc networks. Electronics and Communications in Japan (Part I: Communications), 88(1), 44-52. 12. Rappaport, T. S. (1996). Wireless communications: principles and practice (Vol. 2). New Jersey: prentice hall PTR. 13. Benzair, K. (1995, April). Measurements and modelling of propagation losses through vegetation at 1-4 GHz. In IEE CONFERENCE PUBLICATION (pp. 2-54). INSTITUTION OF ELECTRICAL ENGINEERS. 14. Dalley, J. E. J., Smith, M. S., & Adams, D. N. (1999). Propagation losses due to foliage at various frequencies. 15. Gans, M. J., Amitay, N., Yeh, Y. S., Damen, T. C., Valenzuela, R. A., Cheon, C., & Lee, J. (2002). Propagation measurements for fixed wireless loops (FWL) in a suburban CONCLUSION 261 region with foliage and terrain blockages. IEEE Transactions on Wireless Communications, 1(2), 302-310. 16. Wang, F., & Sarabandi, K. (2007). A physics-based statistical model for wave propagation through foliage. IEEE Transactions on Antennas and Propagation, 55(3), 958-968. 17. Torrico, S. A., & Lang, R. H. (2007). A simplified analytical model to predict the specific attenuation of a tree canopy. IEEE Transactions on Vehicular Technology, 56(2), 696-703. 18. Seyed, A., Zekavat, B. R., & BUEHRER, R. (2012). Handbook of Position Location, Theory Practise and Advances. 19. IEEE 802.11-03/940r4, TGn Channel Models, contribution to 802.11n, 2006. 20. IEEE 802.16 Broadband Wireless Access Working Group, Channel Models for Fixed Wireless Applications, contribution to 802.16a, 2003. [Online] http://wirelessman.org/tga/docs/80216a-03 01.pdf. 21. Johnson, D. B., & Maltz, D. A. (1996). Dynamic source routing in ad hoc wireless networks. In Mobile computing (pp. 153-181). Springer, Boston, MA. 22. S. Aguirre, L.H. Loew, and L. Yeh, Radio Propagation into Buildings at 912, 1920, and 5990 MHz Using Microcells, in Proc. 3rd IEEE ICUPC, pp. 129-134, October 1994. 23. P.I. Wells, The attenuation of UHF radio signals by houses, in IEEE Transactions on Vehicular Technology, Vol. 26, Issue 4, Nov 1977. pp. 358-362. 24. E.F.T. Martijn, M.H.A.J. Herben, Characterization of radio wave propagation into buildings at 1800 MHz, in Antennas and Wireless Propagation Letters, Volume 2, Issue 1, pp. 122-125, 2003. 25. Oestges, C., & Paulraj, A. J. (2004). Propagation into buildings for broad-band wireless access. IEEE Transactions on Vehicular Technology, 53(2), 521-526. 26. United States. National Telecommunications and Information Administration, Loew, L. H., Lo, Y., & Laflin, M. (1995). Building penetration measurements from low-height base stations at 912, 1920, and 5990 MHz. 27. Chebil, J., Lwas, A. K., Islam, M. R., & Zyoud, A. H. (2011, May). Comparison of empirical propagation path loss models for mobile communications in the suburban area of Kuala Lumpur. In 2011 4th International Conference on Mechatronics (ICOM) (pp. 1-5). IEEE. 28. Durgin, G., Rappaport, T. S., & Xu, H. (1998). Measurements and models for radio path loss and penetration loss in and around homes and trees at 5.85 GHz. IEEE Transactions on Communications, 46(11), 1484-1496. 29. Schwengler, T., & Glbert, M. (2000, September). Propagation models at 5.8 GHz-path loss and building penetration. In RAWCON 2000. 2000 IEEE Radio and Wireless Conference (Cat. No. 00EX404) (pp. 119-124). IEEE. 30. Davidson, A., & Hill, C. (1997). Measurement of building penetration into medium buildings at 900 and 1500 MHz. IEEE Transactions on Vehicular Technology, 46(1), 161-168. 31. De Toledo, A. F., Turkmani, A. M., & Parsons, J. D. (1998). Estimating coverage of radio transmission into and within buildings at 900, 1800, and 2300 MHz. IEEE Personal communications, 5(2), 40-47. 262 WIRELESS NETWORK SIMULATION USING MATLAB 32. Tanis, W. J., & Pilato, G. J. (1993, May). Building penetration characteristics of 880 MHz and 1922 MHz radio waves. In IEEE 43rd Vehicular Technology Conference (pp. 206-209). IEEE. 33. Hill, C., & Kneisel, T. (1991). Portable radio antenna performance in the 150, 450, 800, and 900 MHz bands’ outside’and in-vehicle. IEEE Transactions on Vehicular Technology, 40(4), 750-756. 34. Kostanic, I., Hall, C., & McCarthy, J. (1998, May). Measurements of the vehicle penetration loss characteristics at 800 MHz. In VTC’98. 48th IEEE Vehicular Technology Conference. Pathway to Global Wireless Revolution (Cat. No. 98CH36151) (Vol. 1, pp. 1-4). IEEE. 35. Tanghe, E., Joseph, W., Verloock, L., & Martens, L. (2008). Evaluation of vehicle penetration loss at wireless communication frequencies. IEEE transactions on vehicular technology, 57(4), 2036-2041. 36. Damosso, E., & Correia, L. M. (1999). Digital mobile radio towards future generation systems. COST 231 final report, 474. [Online] http://www.lx.it.pt/cost231/ . 37. Chrysanthou, C. H. R. Y. S. A. N. T. H. O. S., & Bertoni, H. L. (1990). Variability of sector averaged signals for UHF propagation in cities. IEEE transactions on Vehicular Technology, 39(4), 352-358. 38. 3GPP TR 25.996, 3rd Generation Partnership Project; Technical Specification Group Radio Access Network; Spatial channel model for Multiple Input Multiple Output (MIMO) simulations (Release 11) [Online] www.3gpp.org/ftp/specs/archive/25 series/25.996/ 39. IEEE 802.11-03/940r4, TGn Channel Models, contribution to 802.11n, 2006. 40. IEEE 802.11-09/0308r3, TGac Channel Models, 2009. 41. IEEE 802.11-09/0569r0, TGac Channel Model Addendum Supporting Material, contribution to 802.11ac, 2009. 42. Rappaport, T. S., Heath Jr, R. W., Daniels, R. C., & Murdock, J. N. (2014). Millimeter wave wireless communications. Pearson Education. 43. NYU Wireless [online]: http://wireless.engineering.nyu.edu 44. European Cooperation in the Field of Scientific and Technical Research, EURO-COST 273, Towards Mobile Broadband Multimedia Communications, COST 273 Final Report, 2006. (MIMO Channel Model available online: http://www.ftw.at/cost273) 45. European Cooperation in the Field of Scientific and Technical Research, EURO-COST 259, European Co-operation in Mobile Radio Research, COST 259 Final Report, 2001. http://www.lx.it.pt/cost259/ 46. COST2100 project. [Online] www.cost2100.org 47. European Cooperation in the Field of Scientific and Technical Research, EURO-COST 231, Urban Transmission Loss Models for Mobile Radio in the 900 and 1800 MHz Bands, COST 231 TD (91) 73. Rev 2, The Hague, September 1991. 48. Torrico, S. A., & Lang, R. H. (2007). A simplified analytical model to predict the specific attenuation of a tree canopy. IEEE Transactions on Vehicular Technology, 56(2), 696-703. 49. Walfisch, J., & Bertoni, H. L. (1988). A theoretical model of UHF propagation in urban environments. IEEE Transactions on antennas and propagation, 36(12), 1788-1796. CONCLUSION 263 50. Erceg, V., Greenstein, L. J., Tjandra, S. Y., Parkoff, S. R., Gupta, A., Kulic, B., ... & Bianchi, R. (1999). An empirically based path loss model for wireless channels in suburban environments. IEEE Journal on selected areas in communications, 17(7), 12051211. 51. Yoon, J., Liu, M., & Noble, B. (2003, March). Random waypoint considered harmful. In IEEE INFOCOM 2003. Twenty-second Annual Joint Conference of the IEEE Computer and Communications Societies (IEEE Cat. No. 03CH37428) (Vol. 2, pp. 1312-1321). IEEE. 52. Bettstetter, C., Resta, G., & Santi, P. (2003). The node distribution of the random waypoint mobility model for wireless ad hoc networks. IEEE Transactions on mobile computing, 2(3), 257-269. 53. Navidi, W., & Camp, T. (2004). Stationary distributions for the random waypoint mobility model. IEEE transactions on Mobile Computing, (1), 99-108. 54. Le Boudec, J. Y. (2007). Understanding the simulation of mobility models with palm calculus. Performance evaluation, 64(2), 126-147. 55. Le Boudec, J. Y., & Vojnovic, M. (2006). The random trip model: stability, stationary regime, and perfect simulation. IEEE/ACM Transactions On Networking, 14(6), 11531166. 56. Hyytia, E., Lassila, P., & Virtamo, J. (2006). Spatial node distribution of the random waypoint mobility model with applications. IEEE Transactions on mobile computing, 5(6), 680-694. 57. Hyyti, E., & Virtamo, J. (2005). Random waypoint model in n-dimensional space. Operations Research Letters, 33(6), 567-571. 58. Hyyti, E., & Virtamo, J. (2007). Random waypoint mobility model in cellular networks. Wireless Networks, 13(2), 177-188. 59. Hyytia, E., Lassila, P., & Virtamo, J. (2006, June). A markovian waypoint mobility model with application to hotspot modeling. In 2006 IEEE International Conference on Communications (Vol. 3, pp. 979-986). IEEE. 60. Resta, G., & Santi, P. (2002, October). An analysis of the node spatial distribution of the random waypoint mobility model for ad hoc networks. In Proceedings of the second ACM international workshop on Principles of mobile computing (pp. 44-50). ACM. 61. Bettstetter, C., Hartenstein, H., & Prez-Costa, X. (2004). Stochastic properties of the random waypoint mobility model. Wireless Networks, 10(5), 555-567. 62. Bettstetter, C., & Wagner, C. (2002). The Spatial Node Distribution of the Random Waypoint Mobility Model. WMAN, 11, 41-58. 63. Johnson, D. B., & Maltz, D. A. (1996). Dynamic source routing in ad hoc wireless networks. In Mobile computing (pp. 153-181). Springer, Boston, MA. 64. Ren, S., Guo, L., & Zhang, X. (2006). ASAP: an AS-aware peer-relay protocol for high quality VoIP. In 26th IEEE International Conference on Distributed Computing Systems (ICDCS’06) (pp. 70-70). IEEE. 65. Guo, L., Chen, S., Xiao, Z., Tan, E., Ding, X., & Zhang, X. (2005, October). Measurements, analysis, and modeling of BitTorrent-like systems. In Proceedings of the 5th ACM SIGCOMM conference on Internet Measurement (pp. 4-4). USENIX Association. 264 WIRELESS NETWORK SIMULATION USING MATLAB 66. Wang, Z., & Huang, D. (2018). Privacy-preserving mobile crowd sensing in ad hoc networks. Ad Hoc Networks, 73, 14-26. 67. Le, D. N., Kumar, R., Nguyen, G. N., & Chatterjee, J. M. (2018). Cloud Computing and Virtualization. John Wiley & Sons. 68. Le, D. N., Kumar, R., Mishra, B. K., Chatterjee, J. M., & Khari, M. (Eds.). (2019). Cyber Security in Parallel and Distributed Computing: Concepts, Techniques, Applications and Case Studies. John Wiley & Sons. 69. Makowski, ., & Grosso, P. (2019). Evaluation of virtualization and traffic filtering methods for container networks. Future Generation Computer Systems, 93, 345-357. 70. Chroboczek, J. (2011). The babel routing protocol. 71. Joa-Ng, M., & Lu, I. T. (1999). A peer-to-peer zone-based two-level link state routing for mobile ad hoc networks. IEEE Journal on selected areas in communications, 17(8), 1415-1425. 72. Mingliang Jiang, Jinyang Li, Y.C. Tay (1999), Cluster Based Routing Protocol, IETF Draft, 27 pages. 73. Perkins, C. E., & Royer, E. M. (1999, February). Ad-hoc on-demand distance vector routing. In Proceedings WMCSA’99. Second IEEE Workshop on Mobile Computing Systems and Applications (pp. 90-100). IEEE. 74. Weiss, E., Hiertz, G. R., & Xu, B. (2005, May). Performance analysis of temporally ordered routing algorithm based on IEEE 802.11 a. In 2005 IEEE 61st Vehicular Technology Conference (Vol. 4, pp. 2565-2569). IEEE. 75. Johnson, D. B. (2000). The dynamic source routing protocol for mobile ad hoc networks. IETF Internet Draft, http://www. ietf. org/internetdrafts/draft-ietf-manet-dsr04. txt. 76. Park, V. D., & Corson, M. S. (1997, April). A highly adaptive distributed routing algorithm for mobile wireless networks. In Proceedings of INFOCOM’97 (Vol. 3, pp. 1405-1413). IEEE. http://www.ics.uci.edu/ atm/adhoc/paper-collection/corsonadaptive-routing-infocom97.pdf 77. Perkins, C., Belding-Royer, E., & Das, S. (2003). Ad hoc on-demand distance vector (AODV) routing (No. RFC 3561). 78. Toh, C. K. (1999). Long-lived ad-hoc routing based on the concept of associativity. Internet-Draft, draft-ietf-manet-longlived-adhoc-routing-00. txt, Work in progress. 79. Dube, R., Rais, C. D., Wang, K. Y., & Tripathi, S. K. (1997). Signal stability-based adaptive routing (SSA) for ad hoc mobile networks. IEEE Personal communications, 4(1), 36-45. http://www.cs.umd.edu/projects/mcml/papers/pcm97.ps 80. Iwata, A., Chiang, C. C., Pei, G., Gerla, M., & Chen, T. W. (1999). Scalable routing strategies for ad hoc wireless networks. IEEE journal on selected areas in communications, 17(8), 1369-1379. http://www.cs.ucla.edu/NRL/wireless/PAPER/jsac99.ps.gz 81. Chen, T. W., & Gerla, M. (1998, June). Global state routing: A new routing scheme for ad-hoc wireless networks. In ICC’98. 1998 IEEE International Conference on Communications. Conference Record. Affiliated with SUPERCOMM’98 (Cat. No. 98CH36220) (Vol. 1, pp. 171-175). IEEE.. http://www.ics.uci.edu/ãtm/adhoc/papercollection/gerla-gsr-icc98.pdf CONCLUSION 265 82. Pei, G., Gerla, M., & Chen, T. W. (2000, June). Fisheye state routing: A routing scheme for ad hoc wireless networks. In 2000 IEEE International Conference on Communications. ICC 2000. Global Convergence Through Communications. Conference Record (Vol. 1, pp. 70-74). IEEE. 83. Chiang, C. C., Wu, H. K., Liu, W., & Gerla, M. (1997, April). Routing in clustered multihop, mobile wireless networks with fading channel. In proceedings of IEEE SICON (Vol. 97, No. 1997, pp. 197-211). http://www.ics.uci.edu/ atm/adhoc/papercollection/gerla-routing-clustered-sicon97.pdf 84. Royer, E. M., & Toh, C. K. (1999). A review of current routing protocols for ad hoc mobile wireless networks. IEEE personal communications, 6(2), 46-55. 85. Perkins, C. E., & Bhagwat, P. (1994, October). Highly dynamic destinationsequenced distance-vector routing (DSDV) for mobile computers. In ACM SIGCOMM computer communication review (Vol. 24, No. 4, pp. 234-244). ACM. http://www.svrloc.org/ charliep/txt/sigcomm94/paper.ps 86. Li, Z., & Mohapaira, P. (2004, March). The impact of topology on overlay routing service. In IEEE INFOCOM 2004 (Vol. 1). IEEE. 87. Basagni, S., Chlamtac, I., Syrotiuk, V. R., & Woodward, B. A. (1998, October). A distance routing effect algorithm for mobility (DREAM). In Proceedings of the 4th annual ACM/IEEE international conference on Mobile computing and networking (pp. 76-84). ACM. 88. Klein, A., Braun, L., & Oehlmann, F. (2012, June). Performance study of the better approach to mobile adhoc networking (BATMAN) protocol in the context of asymmetric links. In 2012 IEEE International Symposium on a World of Wireless, Mobile and Multimedia Networks (WoWMoM) (pp. 1-7). IEEE. 89. Liu, Q., Kk, M. A., Ghani, N., & Gumaste, A. (2006). Hierarchical routing in multidomain optical networks. Computer Communications, 30(1), 122-131. 90. Garcia, J. E., Kallel, A., Kyamakya, K., Jobmann, K., Cano, J. C., & Manzoni, P. (2003, October). A novel DSR-based energy-efficient routing algorithm for mobile adhoc networks. In 2003 IEEE 58th Vehicular Technology Conference. VTC 2003-Fall (IEEE Cat. No. 03CH37484) (Vol. 5, pp. 2849-2854). IEEE. CHAPTER 7 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB Abstract In this chapter, we explain various layers and protocols like Vehicle Network Toolbox. In this toolbox, we explain how to make a receiving channel, how to access a channel, how to start a channel, how to transmit a message, etc. Next, in Network Management (NM) we explain planning of network installation, setting up a remote client access configuration, interaction layer, directing protocols in MANET - their results and analysis, and transport layer with detailed protocols. Keywords: Vehicle network toolbox, network management, interaction layer, transport protocols, MANET. Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 267 268 7.1 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB Vehicle Network Toolbox Vehicle Network Toolbox provides MATLAB functions and Simulink blocks to send, receive, encode, and decode CAN, CAN FD, J1939, and XCP messages. The toolbox lets you identify and parse specific signals using industry-standard CAN database files and then visualize the decoded signals using the CAN Bus Monitor app. Using A2L description files, you can connect to an ECU via XCP on CAN or Ethernet. You can access messages and measurement data stored in MDF files. The toolbox simplifies communication with in-vehicle networks and lets you monitor, filter, and analyze live CAN bus data, or log and record messages for later analysis and replay. You can simulate message traffic on a virtual CAN bus or connect to a live network or ECU. Vehicle Network Toolbox supports CAN interface devices from Vector, Kvaser, PEAK-System, and National Instruments. 7.1.1 Transmit and Receive CAN Messages This case demonstrates the proper methodologies to utilize CAN channels to transmit and receive CAN messages. It utilizes MathWorks Virtual CAN diverts associated in a loopback design. 7.1.1.1 Make a Receiving Channel Make a CAN channel to receive messages by determining the seller name, gadget name, and gadget channel record. 1 rxCh = canChannel(’MathWorks’, ’Virtual 1’, 2); 7.1.1.2 Assess the Channel Utilize Inspire summon to acquire more essential data on the greater part of the channel’s properties and their present qualities. 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 get(rxCh) %.................................................................. ArbitrationBusSpeed: [] DataBusSpeed: [] ReceiveErrorCount: 0 TransmitErrorCount: 0 InitializationAccess: 1 InitialTimestamp: [0x0 datetime] SilentMode: 0 TransceiverState: ’N/A’ BusSpeed: 500000 NumOfSamples: [] SJW: [] TSEG1: [] TSEG2: [] BusStatus: ’N/A’ TransceiverName: ’N/A’ Database: [] MessageReceivedFcn: [] VEHICLE NETWORK TOOLBOX 19 20 21 22 23 24 25 26 27 28 29 30 31 269 MessageReceivedFcnCount: 1 UserData: [] FilterHistory: ’Standard ID Filter: Allow All | Extended ID Filter: Allow All’ MessagesReceived: 0 MessagesTransmitted: 0 Running: 0 Device: ’Virtual 1’ DeviceChannelIndex: 2 DeviceSerialNumber: 0 DeviceVendor: ’MathWorks’ ProtocolMode: ’CAN’ MessagesAvailable: 0 7.1.1.3 Start the Channel To open the channel online, utilize the start command. 1 start(rxCh); 7.1.1.4 Transmit Messages The example function generateMsgs makes CAN messages and transmits them at different intermittent rates. It makes activity on the CAN transport for instance purposes and isn’t a piece of the Vehicle Network Toolbox. 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 type generateMsgs Function generateMsgs() %.................................................................. % generateMsgs Creats and transmits CAN messages for demo purposes. % generateMsgs periodically transmits multiple CAN messages at % various periodic rates with changing message data. % Copyright 2008-2016 The Mathworks,Inc. % Create the messages to send using the canMessage function.The % identifier,an indication of standard or extended type,and the data % length is given for each message. %.................................................................. msgTx100 = canMessage(100,false,0); msgTx200 = canMessage(200,false,2); msgTx400 = canMessage(400,false,4); msgTx600 = canMessage(600,false,6); msgTx800 = canMessage(800,false,8); %.................................................................. %Create a CAN channel on which to transmit. %.................................................................. Txch = canChannel(’mathworks’,’virtual 1’,1); %.................................................................. % Register each message on the channel at a specified periodic time. %.................................................................. transmitperiodic(txch,msgTx100,’on’,0.500); transmitperiodic(txch,msgTx200,’on’,0.250); transmitperiodic(txch,msgTx400,’on’,0.125); transmitperiodic(txch,msgTx600,’on’,0.50); transmitperiodic(txch,msgTx800,’on’,0.025); 270 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB % start the CAN channel. Start(txch); %.................................................................. % Run for several seconds incrementing the message data regularly. %.................................................................. For ii=1:50 % Increment the message data bytes. msgTxt200.Data = msgTx200.Data + 1; msgTxt400.Data = msgTx400.Data + 1; msgTxt600.Data = msgTx600.Data + 1; msgTxt800.Data = msgTx800.Data + 1; % wait for a time period. Pause(0.100); End %stop the CAN channel. End Run the generateMsgs capacity to transmit messages for the case. 1 generateMsgs(); 7.1.1.5 Receive Messages When generateMsgs finishes, get the majority of the accessible messages from the channel. 1 2 rxMsg = receive(rxCh, Inf, ’OutputFormat’, ’timetable’); rxMsg(1:25, :) Result: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ans = 25x8 timetable Time ID Extended Name Data Length Signals Error Remote ___________________________________________________________________ 0.0041761 sec 100 false ’’ [1x0 uint8] 0 [0x0 struct] false false 0.0041796 sec 200 false ’’ [1x2 uint8] 2 [0x0 struct] false false 0.004184 sec 400 false ’’ [1x4 uint8] 4 [0x0 struct] false false 0.0041921 sec 600 false ’’ [1x6 uint8] 6 [0x0 struct] false false 0.004193 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.029181 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.054183 sec 600 false ’’ [1x6 uint8] 6 [0x0 struct] false false 0.054185 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.079178 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.10418 sec 600 false ’’ [1x6 uint8] 6 [0x0 struct] false false 0.10418 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.12919 sec 400 false ’’ [1x4 uint8] 4 [0x0 struct] false false 0.12919 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.15419 sec 600 false ’’ [1x6 uint8] 6 [0x0 struct] false false 0.15419 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.17919 sec 800 false ’’ [1x8 uint8] 8 [0x0 struct] false false 0.20418 sec 600 false ’’ [1x6 uint8] 6 [0x0 struct] false false VEHICLE NETWORK TOOLBOX 25 26 27 28 29 30 31 32 0.20421 0.22918 0.25418 0.25419 0.25419 0.25419 0.27918 0.30419 7.1.1.6 sec sec sec sec sec sec sec sec 800 800 200 400 600 800 800 600 false false false false false false false false ’’ ’’ ’’ ’’ ’’ ’’ ’’ ’’ [1x8 [1x8 [1x2 [1x4 [1x6 [1x8 [1x8 [1x6 uint8] uint8] uint8] uint8] uint8] uint8] uint8] uint8] 8 8 2 4 6 8 8 6 [0x0 [0x0 [0x0 [0x0 [0x0 [0x0 [0x0 [0x0 struct] struct] struct] struct] struct] struct] struct] struct] false false false false false false false false 271 false false false false false false false false Stop the Channel Utilize the stop summon to set the channel disconnect. 1 Stop(rxCh); 7.1.2 Examine Received Messages MATLAB provides a great method for performing examinations on CAN messages. The plot order can make a disperse plot with message timestamps and identifiers to give an outline of when certain messages happened on the system. CODE 1 2 3 4 5 6 7 8 9 10 11 12 %.................................................................. % Receive all available messages. %.................................................................. rxMsg = receive(rxCh, Inf, ’OutputFormat’, ’timetable’); %.................................................................. % Plot the signal values against their message timestamps. %.................................................................. plot(rxMsg.Time, rxMsg.ID, ’x’); ylim([0 2047]) xlabel(’Timestamp’); ylabel(’CAN Identifier’); OUTPUT Figure 7.1 Timestamp identification. 272 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB 7.1.3 CAN Message Reception Callback Function 7.1.3.1 Make a Receiving Channel Make a CAN channel to get messages by determining the merchant name, gadget name, and gadget channel list. 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 rxCh = canChannel(’MathWorks’, ’Virtual 1’, 2); rxCh = Channel with properties: Device Information DeviceVendor: ’MathWorks’ Device: ’Virtual 1’ DeviceChannelIndex: 2 DeviceSerialNumber: 0 ProtocolMode: ’CAN’ Status Information Running: 0 MessagesAvailable: 0 MessagesReceived: 5 MessagesTransmitted: 0 InitializationAccess: 1 InitialTimestamp: 27-Aug-2018 12:38:35 FilterHistory: ’Standard ID Filter: Allow Only | Extended ID Filter: Allow All’ Channel Information BusStatus: ’N/A’ SilentMode: 0 TransceiverName: ’N/A’ TransceiverState: ’N/A’ ReceiveErrorCount: 0 TransmitErrorCount: 0 BusSpeed: 500000 SJW: [] TSEG1: [] TSEG2: [] NumOfSamples: [] Other Information Database: [] UserData: [] 7.1.3.2 Arrange the Callback Function Set a callback feature on the channel to trigger by means of approaching messages. 1 rxCh.MessageReceivedFcn = @receivingFcn; 7.1.3.3 Arrange the Message Received Count Determine an accessible message limit to control the number of messages required in the channel before the callback work is activated. 1 rxCh.MessageReceivedFcnCount = 30; VEHICLE NETWORK TOOLBOX 7.1.3.4 273 Actualize the Callback Function The callback function gets messages from the channel on every execution and plots the CAN identifiers against their timestamps on every execution. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Type receivingFcn Work receivingFcn(rxCh) %.................................................................. %RECEIVINGFCN A CAN channel message get callback work. %This is a callback work used to get CAN message.It gets % messages from the channel RXCH and plots the outcome. %Copyright 2009-2016 The MathWorks, Inc. %Receive every single accessible message. %.................................................................. rxMsg = receive(rxCh,Inf’OutputFormat’,’timetable’); %.................................................................. %Plot the signal esteems against their message timestamps. %.................................................................. Plot(rxMsg.Time,rxMsg.ID,’x’); Ylim([0 2047]) Xlabel(’Timestamp’); Ylabel(’CAN Identifier’); Hold all; End 7.1.3.5 Begin the Channel Utilize the begin order to set the channel on the web. 1 start(rxCh); 7.1.3.6 Execute the Callback Function The function generateMsgs creates CAN messages and transmits them at different occasional rates. It makes activity on the CAN transport for instance purposes and isn’t a piece of the Vehicle Network Toolbox. As the messages are transmitted, the callback function executes each time the message received work tally edge is met (See Figure 7.2). 1 generateMsgs(); Figure 7.2 Execute the callback function. 274 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB 7.1.3.7 Investigate the Remaining Messages Note the rest of the messages in the channel. Since the accessible message tally is underneath the edge indicated before, more messages are required to trigger the callback some other time. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 rxCh = Channel with properties: Gadget Information DeviceVendor : MathWorks Gadget:Virtual 1 DeviceChannelIndex: 2 DeviceSerialNumber: 0 ProtocolMode: CAN Status Information Running: 1 MessagesAvailable: 17 MessagesReceived: 406 MessagesTransmitted: 0 InitializationAccess: 1 InitialTimeStamp: 26-Feb-2018 18:37:29 FilterHistory:Standard ID Filter:Allow All | Extended ID Filter:Allow All Channel Information BusStatus: N/A SilentMode: 0 TransceiverName: N/A TransceiverState: N/A ReceiverErrorCount: 0 TransmitErrorCount: 0 BusSpeed: 500000 SJW: [] TSEG1: [] TSEG2: [] NumOfSamples: [] Other Information Database: [] UserData: [] 7.1.3.8 Stop the Channel Utilize the stop charge to set the channel disconnect. 1 stop(rxCh); 7.2 7.2.1 Network Management (NM) Plan Your Network Installation In a common system setup, you make MathWorks items accessible to clients with access to your system. These arrangements utilize permit keys to control access to MathWorks items. Customers MATLAB looks at a permit key when it starts up or utilizes works in different items. While arranging a system establishment, you should: NETWORK MANAGEMENT (NM) 275 1. Determine how you need to design the items for clients - There are a few conceivable setups. Choose whether clients will introduce MATLAB on their PCs or access MATLAB over a system. 2. Install the product on the PCs required by the design - You should introduce the permit administrator on a server and, contingent upon your setup, either introduce MathWorks items on a server or introduce the items on customer frameworks. 7.2.2 Planning Your Network Installation For corporate environments, MathWorks utilizes FlexNet Publisher, a software license manager from Flexera Software. To set up a system establishment, you should introduce the permit administrator and introduce MathWorks items. In the event that you need to coordinate MathWorks items in a precisely settled under control manner, you can duplicate the MathWorks permit administration daemons onto your framework as opposed to utilizing the installer to introduce permit director [11-15]. 7.2.3 Setting Up a Remote Client Access Configuration In a remote that customers get to design, you introduce MATLAB and the permit administrator on a focal document server. (These directions allude to this framework as your permit server.) Users on customer frameworks get to MATLAB over the system. Figure 7.3 demonstrates one conceivable setup. The permit supervisor and MATLAB can be introduced on a similar server or on discrete servers. Figure 7.3 Remote client access configuration setup. On the off chance that your permit server runs the Windows working framework, follow the directions in the establishment control. Your setup can incorporate a blend of frameworks. For instance, a Linux license server can serve customers running Windows. 7.2.4 Setting Up Local Client Access Configuration In a neighborhood customers get to design, you introduce the permit supervisor on a server and you introduce MATLAB on every customer framework. At the point 276 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB when clients on customer frameworks begin MATLAB, it contacts the permit chief over the system to look at a permit key. This figure demonstrates one conceivable setup. You utilize a similar fundamental system establishment method to introduce MathWorks items on a customer framework. Figure 7.4 Local client access configuration setup. Contingent upon your system design, you could play out different scenarios: Installing the permit administrator on a server - To arrange establishments, you should introduce the FlexNet permit supervisor to access items. You introduce the permit director on a server that is accessible to all your system clients, referred to in this documentation as the permit server. Installing MathWorks items on a server - If your arrangement calls for clients to utilize MathWorks items from a focal area, as opposed to introducing the items on their neighborhood framework, introduce the item documents on a server. In the event that this server is indistinguishable framework from your permit server (it doesn’t need to be), you can introduce MathWorks items in the meantime as you introduce the main content. Installing MathWorks items on every customer framework - If your system setup calls for clients to introduce MathWorks items on all stand-alone frameworks and just access the permit server over the system, at that point you should introduce the item documents on every framework. The customer frameworks must have the capacity to interface with the permit server over a system. See Install MathWorks Software on Client Systems (Installation, Licensing, and Activation).1 Rather than playing out the established methods intuitively, giving the data asked for by every discourse box, you can run the installer non-interactively. In this mode, you enter all the data in a property document that you would typically give utilizing the installer discourse boxes. 1 https://www.mathworks.com/help/install/ug/install-mathworks-software.html INTERACTION LAYER 7.3 277 Interaction Layer Portable specially appointed systems (MANETs) assume an extraordinary part in military applications where clients share data with each other while moving. The development of individual’s changes depends on the layers, e.g., individuals may move haphazardly in various ways (Random Waypoint); or move as a gathering (Reference Point Group Mobility demonstrates). Because of the nearness of portability in the versatile specially appointed system (MANET), the interconnections between hubs are probably going to change, bringing about continuous changes of system topology. In this way, directing turns into an essential factor and a noteworthy test in such a system. Despite the fact that TCP was created to be utilized in wired system situations, it still is required on the grounds that it very well may be utilized in the present Internet and can be incorporated with settled system. So TCP allows interoperability between wired system and remote specially appointed system. Because of the dynamic nature (hub portability) of MANET, TCP turns out to be more forceful if there should be an occurrence of bundle odd and retransmit a lost packet and superfluously causes a vitality odd. Consequently, it is of most extreme significance to recognize the most reasonable and proficient versatility shown for specially appointed directing convention that can perform well in MANET. In this section, we analyze the execution of directing convention in light of bundle conveyance proportion, steering overhead, packet odd rate and normal end-to-end delay crosswise over versatility model and discover the communication among them. Result demonstrates that the execution of steering convention fluctuates with various versatility display utilized and association design. We see that DSR and AODV accomplish the most noteworthy throughput and slightest overhead with RPGM when contrasted with RWP portability models. A MANET is one of the self-governing gatherings of portable hubs framing an irregular system and conveying over remote connections. This sort of system is more reasonable where organizing foundation isn’t accessible and set-up time is less and impermanent system availability is required. In MANET, TCP execution isn’t as steady as in wired systems. Besides, the part of directing conventions among hubs turns into a testing undertaking in light of the fact that the hubs move autonomously. There are many steering conventions accessible in MANET. Among them impromptu on request separate vector (AODV) [1] and dynamic source routing (DSR) [2] are responsive directing conventions. AODV convention is institutionalized by IETF MANET working gatherings [3]. These steering conventions work at organize layer. Transmission Control Protocol (TCP) [4] is an association situated and stable end to-end transport convention that was planned and tweaked to perform well on systems where the conclusion to-end association is wired, and the bundle odds are essentially because of blockage. The development of hubs and network designs are continually changing, contingent upon the use of portability models, and thus, impact the execution of steering conventions, bringing about expanded postponement and directing load and additionally diminished throughput. The portability models assume an extremely fundamental part since individuals in a versatile, unavoidable processing condition move as required. Under these conditions, the 278 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB steering conventions must have the capacity to deal with the development of hubs, the delay day and age of nodes and different kinds of activity stack that could impact the general system execution. The goal of our work here is to break down the cooperation between portability display (random waypoint and reference point group mobility) and uni-path directing conventions (AODV and DSR) with TCP as transport convention. 7.3.1 Directing Protocols in MANET Directing is one of the key issues in MANETs because of their profoundly powerful and appropriated nature. In wired systems course disappointments happen once in a while; however, in MANETs they are mobile nodes events. Another factor that may prompt course disappointments is the connection disappointments because of the dispute on the remote channel, which is the fundamental driver of execution debasement in MANETs. The course re-foundation span after a course disappointment in impromptu systems relies upon the hidden steering convention, an example of versatility of portable hubs, and the movement qualities. All proposed directing conventions depend on least jumps in portable specially appointed system. Taksande and Kulat considered the bury layer association amongst MAC and physical layer and showed that despite the fact that DSR and AODV share a comparable conduct, the distinctions in the convention mechanics can prompt huge execution differentials. Mohapatra and Kanungo assessed the execution of AODV, DSR and OLSR steering conventions in MANETs under CBR movement with various system conditions. 7.3.2 Specially Appointed On-Demand Distance Vector In AODV [1, 5, 6], when a source node wants to make an impression on some goal hub and does not as of now have a legitimate course to that goal, it starts a course revelation process. It communicates a course ask for (RREQ) bundle to its neighbors, which at that point forwards the demand to their neighbors, et cetera, until either the goal or a halfway hub with a new course to the goal is found. Once the RREQ achieves the goal or a moderate center with suitably crisp course, the goal or central point of the road center reacts by uni-casting answer (RREP) packet reverse to the hop from where it has gotten the main Route Request. At the point when a course breakage happens amid information transmission, the middle of the road hub which recognized the course breakage endeavors to find the new course or sends a RERR message towards the source. While getting the RERR message, the source endeavors to gain another course by playing out a similar course disclosure technique. 7.3.3 Dynamic Source Routing (DSR) The key component of DSR [2] is the utilization of source routing instead of relying on routing table. RREQ and RREP packets are likewise source directed. The RREQ develops the way navigated up until now; the RREP courses itself back to the source by crossing this way in reverse, and the course conveyed back by the RREP packet is INTERACTION LAYER 279 stored at the hotspot for some time later. In the event that any connection on a source course is broken, the source hub is told utilizing a course mistake (RERR) packet. 7.3.4 Diagram of Mobility Model Keeping in mind the end goal to recreate steering conventions for an impromptu system, it is basic to utilize versatility models that portray the development examples of the hubs. Random Waypoint Mobility Model (RWP) [7] has been utilized to assess specially appointed steering conventions as a result of its effortlessness and wide accessibility. When this time lapses, the hub picks a goal and moves at an arbitrarily chosen speed. This speed is chosen from a consistently circulated speed amongst least and greatest speed. Upon landing in the goal, the above procedure is begun once again once more. Reference Point Group Mobility Model (RPGM) [8] is a gathering model which speaks to the arbitrary development of a gathering and every hub inside the gathering. Gathering developments of hubs depend on a legitimate focus, which characterizes the gathering movement conduct, including area, speed, increasing speed and so on. Two vectors, bunch movement vector and individual movement vector, characterize the development of every hub. Each individual hub inside the gathering has a reference point which takes after the gathering development. By changing the check focuses, the different moving situations are made. A hub is arbitrarily put in the area of its reference point at each progression. Table 7.1 Parameter values in simulation. 280 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB We utilized NS-2 (NS simulator) test system to look at how the versatility shows cooperate with specially appointed directing with various hub speed and diverse connections. We utilize RWP and RPGM as portability model and AODV and DSR as impromptu directing convention and TCP as transport layer protocol [9, 10, 20]. 7.3.5 Results and Analysis In this segment, we give the outcomes obtained from the investigations for various situations. The situations fluctuate by portability variety and number of connections. We do reproductions to assess the portability demonstrate associate with directing conventions as indicated by the two variations hub speed and distinctive connections. We utilize TCP as transport convention which is broadly utilized in current Internet. Jayakumar and Ganapathi specified that the execution of directing convention may fluctuate significantly as indicated by the portability model and execution positioning. Our outcome demonstrates that system performance might be influenced by versatility model and connection pattern [9, 10]. Mobility Variation Results: First, we think about the impact of portability on the impromptu directing conventions with RWP and RPGM, which keeps in memory the end goal and check connection between the steering convention and versatility demonstrate. First, bundle conveyance proportion (PDR) and packet odd rate of TCP is estimated over AODV and DSR having several versatile hubs. We discovered AODV indicates somewhat preferable execution over DSR over RPGM demonstrate (see Figure 7.5). Figure 7.5 PDR vs Node Mobility. The packet conveyance proportion of DSR crosswise over RWP display is lower than others when the hub speed increases. Be that as it may, regardless of impromptu steering convention execution and versatility shown, PDR diminishes with increment of hub portability. Since when hub portability builds the connection disappointment happens all the more habitually this causes more bundle odd and declines PDR. The responsive directing convention finds courses on request, which causes the expansion of level of packet odd with the expansion of hub speed. While applying TCP activity INTERACTION LAYER 281 to the AODV convention, the level of packet odd rate for RPGM demonstrate are somewhat higher than others, as shown in Figure 7.6. Figure 7.6 Packet Loss Rate vs Node Mobility. In RPGM versatility display, most hubs don’t endure the impacts of the high hub speeds since all hubs inside a gathering can exchange packets. Despite the fact that the level of bundle odd rates increases directly when AODV steering convention is used (see Figure 7.6), the execution change (PDR) of AODV is experienced with RPGM. In DSR level of bundle odd rate is not as much as AODV because of involvement of course caching procedure. At the end of the day, AODV and DSR perform contrastingly despite the fact that both offer comparable on-request conduct. Next, we measure steering overhead and normal end-to-end delay with various hubs versatility. Figure 7.7 demonstrates that DSR endures the most exceedingly awful steering overhead as the hub speed increases with RWP display. DSR may have different source courses in its course stores that can give the hubs to give courses without asking for the course disclosure methodology. In any case, this could prompt expanded unusable courses when course changes happen all the more regularly. Finding courses after the arrangement of the stale courses in the high hub speed builds the steering overhead massively. Figure 7.7 Routing Overhead vs Node Mobility. 282 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB The arrangement of TCP’s affirmation conspire exacerbates the execution of DSR. With RWP display, as shown in Figure 7.8, we see that DSR has higher postponement as the hub speed increases if contrasted with others. In any case, defer increment for all with increment of hub speed. In spite of the fact that AODV and DSR share on request conduct of single way steering convention between a source and goal combine, for TCP movement, DSR endures a higher postponement in RWP demonstrate if contrasted with AODV. AODV has an exceptional clock instrument to recognize course breaks and sufficiently refreshes new courses while DSR does not contain any express component to terminate stale courses in the store. The stale courses are later distinguished by course error bundles, prompting execution debasement. Figure 7.8 7.3.6 Average End-to-End Delay vs Node Mobility. Association Variation Results In this section, we measure the PDR, bundle odd proportion, directing overhead and normal end-to-end deferral of TCP over AODV and DSR by changing number of connections from 5 to 25. Figure 7.9 Packet Delivery Ratio vs Number of Connections. In Figure 7.9, DSR with RPGM model can effectively convey information bundles to others for 5 to 25 connections on the grounds that DSR enables hubs to keep INTERACTION LAYER 283 various source courses to a goal in their reserve. At the point when a connection fizzles, the source hub can check its course store for another legitimate course without remaking the course once more. AODV has more terrible packet conveyance execution for TCP activity in RWP display since it utilizes a clock for course lapse, drops a few bundles when a course terminates, and at that point begins finding course once more. As the quantity of connections expands, the DSR’s source directing instrument clogs the system, which thusly drives the stale course issue, driving an expanded steering overhead (see Figure 7.10). Figure 7.10 Routing Overhead vs Number of Connections. In Figure 7.11, AODV with RPGM endures more prominent bundle odd rates than others, though DSR accomplishes a lower packet odd rate while utilizing TCP activity because of gathering developments with number of connections tending to cause organized blockage as opposed to connect disappointments. The connection layer input reports blockage as connection disappointments despite the fact that when the hubs are generally static a physical connection exists between hubs. Such fake connection disappointments prompt another course revelation in AODV. Figure 7.11 Packet Loss Rate vs Number of Connections. 284 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB As shown in Figure 7.12, AODV with RPGM accomplishes impressive bring down postponement if contrasted with others. Be that as it may, delay increases with increment number of associations in the system for all. The expanded number of connections causes clogs in the system and sets aside greater opportunity for throughput movement. Figure 7.12 Average End-to-End Delay vs Number of Connections. Obviously, versatility model demonstrates that the hub speed affects the connection states of the portability models, which thusly impacts the execution of the steering conventions. In this examination, we dissect the effect of versatility design on steering execution of portable, specially appointed systems and collaboration between them in a precise way. It is seen that the versatility design impacts the execution of MANET directing conventions. There is an unmistakable association between versatility metric, availability, and execution. As hub speed builds, the connection security of the RPGM is the best because of its gathering movement design. We see that DSR and AODV accomplish the most astounding throughput and slightest overhead with RPGM when contrasted with RWP portability models. This is on the grounds that with comparative relative speed, between irregular waypoint and RPGM, high level of spatial reliance for RPGM implies higher connection span and correspondingly higher way node, which thusly will result in higher throughput and lower steering overhead. From the recreation results, it can be seen that AODV has better throughput, less directing overhead and less postponement in RPGM demonstrate when contrasted with RWP display. For conditions, for example, military activity, AODV may rise as a superior decision. We call attention to the fact that the general execution relies upon not just the utilization of conduct of steering conventions but also on the development example of versatility displayed [16, 17, 19]. TRANSPORT PROTOCOLS 7.4 285 Transport Protocols 7.4.1 TCP Transport Protocol Simulink Real-Time programming bolsters correspondence from the objective PC to different frameworks or gadgets utilizing Transmission Control Protocol (TCP).2 TCP gives requested and mistake checked packet transport [18]. TCP is a vehicle convention layered over the Internet Protocol (IP). It is generally known as TCP/IP. Stream: TCP is a stream-situated convention. It is a long stream of information that streams from one end of the system to the next. Another long stream of information streams the other way. The TCP stack at the transmitting end is in charge of breaking the flood of information into packets and sending those bundles. The stack at the less than desirable end is in charge of reassembling the bundles into an information stream utilizing data in the packet headers. Connection: TCP is an association-based convention. In TCP, the two closures of the correspondence interface must be associated all through the correspondence. Error Detection: TCP recognizes mistakes. TCP packets contain a novel arrangement number. The beginning succession number is imparted to the opposite side toward the start of correspondence. The recipient recognizes every packet, and the affirmation contains the arrangement number with the goal being that the sender knows which bundle was recognized. In this way, packets lost in transit can be retransmitted. The sender realizes that they didn’t achieve their goal in light of the fact that the sender did not get an affirmation. The recipient can reassemble parcels all together that land out of grouping. Timeouts can be built up, in light of the fact that the sender knows from the initial couple of packets to what extent it takes to transmit a bundle and get its affirmation. You can develop a bundle from Simulink information composes; for example, twofold, int8, int32, uint8, or a blend of these information composes. The Simulink Real-Time square library gives squares to constellating different signs into one bundle (pressing), and after that transmitting it. It likewise gives squares to divide a packet (unloading) into its segment signals that would then be able to be utilized in a Simulink demonstrate. The information above applies to both correspondence with a common Ethernet board and correspondence with a committed Ethernet board. Consider including a devoted Ethernet board for upgraded execution over correspondence utilizing a mutual Ethernet board. Shared TCP correspondence imparts transfer speed to the connection between the advancement and target PCs. The Internet gives an approach to get bundles (advantageous units of information for PCs and switches) from any host PC to at least one other host PC. In any case, 2 https://www.mathworks.com/ 286 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB the system conventions make no certifications about conveying a bundle. Truth be told, a bundle may get lost, may land after others sent later or might be misshaped. A bundle may even arrive that essentially wasn’t sent! To counter this, have PCs constellate transport conventions, which utilize the Internet to bear the application data, yet in addition send an assortment of other data to give checking and rectification or recuperation from such errors. The three agent conventions are given below. 7.4.2 User Datagram Protocol, or UDP UDP is a “send and overlook” convention. It gives simply enough control data toward the beginning of every bundle to tell what application is running, and to check if the packet became contorted on course. UDP is utilized by applications that have no necessity for an answer, regularly, and don’t generally mind if the opposite end got the message. A common case of this may be a server that declares the time on the system, spontaneous. 7.4.3 Reliable Data Protocol, or RDP RDP is a nonspecific name for an accumulation of conventions; here the most applicable one being the one utilized by PROSPERO. RDP compose conventions are like TCP, however with diminished many-sided quality toward the beginning and end of a discussion, and with great help for arrangements of trades of pieces of information, regularly known as Remote Procedure Calls, or now and again erroneously called exchanges. 7.4.4 Transmission Control Protocol, or TCP TCP is the convention module that gives unwavering quality and security. TCP is intended to adapt to the entire range of system disappointments, and adjusts richly to the accessible assets in the system. It even endeavors to be reasonable for all clients. Transport conventions possess Layer 4 of the OSI convention demonstrate. The conventions at this level give association arranged sessions and dependable information conveyance administrations. The vehicle layer sits over Layer 3 organizing administrations. Framework layer traditions like Internet Protocol give most excellent effort benefits in which they pass on packages but don’t guarantee that the groups will truly be passed on. Consider the postal administration. It conveys letters; however, you don’t have the foggiest idea if they were received except if you arrange to have a conveyance affirmation come back to you. A few applications, for example, constant voice and video, needn’t bother with TCP’s administrations. In a constant stream, it doesn’t bode well to recoup a lost bundle. Speed of conveyance is more vital, so UDP (a constrained administrations transport convention) is utilized. Transport layer conventions give conveyance ensures that are basic for document exchanges and mission-basic applications. TCP utilizes IP, however, it includes the dependability administrations at the cost of even more overhead and marginally di- CONCLUSION 287 minished execution. These administrations work over a “virtual association” that is built up between sender and beneficiary. At the point when a session starts, the sender utilizes a handshake method to set up an association with the recipient. Connection setup and multiplexing: The source has to make contact with the recipient prior to beginning transmitting information packets. The participation is handled in a three-way handshake manner to set up the association, and at that point begins transmitting information. A solitary PC can build up numerous associations with various PCs in the meantime, an element called multiplexing (since the packets for these diverse associations are transmitted over a similar system association). Flow control systems: While moderate begin and clog control are utilized to maintain a strategic distance from organize blockage, stream controls help keep the sender from flooding the recipient with an excessive amount of information. These controls are basic on the grounds that the recipient drops packets when it is overloaded and those bundles must be retransmitted, possibly expanding system blockage and decreasing framework execution. Slow begin and clog control: Once an association has been made, the sender begins sending packets, gradually at first so it doesn’t overpower the system. On the off chance that blockage isn’t terrible, it gets the pace. This is designated “moderate begin.” Later, blockage controls enable the sender to downsize if the system becomes occupied. Reliability benefits: These administrations are utilized to retransmit degenerate, lost, and dropped packets. Positive affirmations affirm to the sender that the beneficiary really got a packet (inability to transmit this affirmation signifies “resend the bundle”). Sequencing is utilized to number bundles with the goal that packets can be returned all together and lost packets can be identified. Error checking identifies undermined packets. 7.5 Conclusion In this chapter we explained the concept of virtual network toolbox, with a focus on the different modeling protocols and the virtual connectivity of the systems in the same network that can give higher data transmission security. Other major related factors to consider were also discussed, such as network management, how to transmit and receive messages using CAN messaging, and how to examine the path of message transmission, among others. The later part of the chapter discussed the concept of network management. Here we explained the process of network installation, setting up VPN and remote client access configuration. Finally, we tried to explain the interaction layer in the best way possible so that students can get a clear idea of how to implement the direct protocols of MANET, 288 MOBILITY MODELING FOR VEHICULAR COMMUNICATION NETWORKS USING MATLAB especially appointed on-demand vectors, dynamic source routing, mobility model, and results of analysis of the MANET. We ended with an explanation of the transport protocol and UDP methods. REFERENCES 1. Perkins, C., Belding-Royer, E., & Das, S. (2003). Ad hoc on-demand distance vector (AODV) routing (No. RFC 3561). 2. Johnson, D. B., Maltz, D. A., & Broch, J. (2001). DSR: The dynamic source routing protocol for multi-hop wireless ad hoc networks. Ad hoc networking, 5, 139-172. 3. Macker, J. P., & Corson, M. S. (1998). Mobile ad hoc networking and the IETF. ACM SIGMOBILE Mobile Computing and Communications Review, 2(1), 9-14. 4. Postel, J. (1981). Transmission control protocol (No. RFC 793). 5. Taksande, V. K., & Kulat, D. K. (2011). Performance comparison of DSDV, DSR, AODV protocol with IEEE 802.11 MAC for chain topology for mobile ad-hoc network using NS-2. In IJCA Special Issue on 2nd National Conference-Computing, Communication and Sensor Network CCSN. 6. Mohapatra, S., & Kanungo, P. (2012). Performance analysis of AODV, DSR, OLSR and DSDV routing protocols using NS2 Simulator. Procedia Engineering, 30, 69-76. 7. Bettstetter, C., Resta, G., & Santi, P. (2003). The node distribution of the random waypoint mobility model for wireless ad hoc networks. IEEE Transactions on mobile computing, (3), 257-269. 8. Jayakumar, G., & Ganapathi, G. (2008). Reference point group mobility and random waypoint models in performance evaluation of MANET routing protocols. Journal of Computer Systems, Networks, and Communications, 2008, 13. 9. Yin, J., ElBatt, T., Yeung, G., Ryu, B., Habermas, S., Krishnan, H., & Talty, T. (2004, October). Performance evaluation of safety applications over DSRC vehicular ad hoc networks. In Proceedings of the 1st ACM international workshop on Vehicular ad hoc networks (pp. 1-9). ACM. 10. Rathore, M., & Kumari, S. (2014). Tracking number plate from vehicle using Matlab. International Journal in Foundations of Computer Science & Technology (IJFCST), 4(3), 43-53. 11. Raychaudhuri, D., Ott, M., & Secker, I. (2005, February). ORBIT radio grid testbed for evaluation of next-generation wireless network protocols. In First International Conference on Testbeds and Research Infrastructures for the DEvelopment of NeTworks and COMmunities (pp. 308-309). IEEE. 12. Cai, S., Gao, Z., Yang, D., & Yao, N. (2013). A network coding based protocol for reliable data transfer in underwater acoustic sensor. Ad Hoc Networks, 11(5), 16031609. 13. Tong, M., & Tang, M. (2010, September). LEACH-B: an improved LEACH protocol for wireless sensor network. In 2010 6th international conference on wireless communications networking and mobile computing (WiCOM) (pp. 1-4). IEEE. CONCLUSION 289 14. Yu, C. K. P., Tiglao, N. M. C., & Limjoco, W. J. R. (2015, November). MATES: A MATLAB-based analytical energy harvesting simulator. In TENCON 2015-2015 IEEE Region 10 Conference (pp. 1-5). IEEE. 15. Cai, S., Yao, N., & Gao, Z. (2015). A reliable data transfer protocol based on twin paths and network coding for underwater acoustic sensor network. EURASIP Journal on Wireless Communications and Networking, 2015(1), 28. 16. Vardhan, S., & Kumar, R. (2011, October). An implementation of time-delay compensation scheme for Networked Control Systems using MATLAB/Simulink. In 2011 International Conference on Computational Intelligence and Communication Networks (pp. 149-153). IEEE. 17. Biradar, S. R., Sarma, H. H., Sharma, K., Sarkar, S. K., & Puttamadappa, C. (2009, May). Performance comparison of reactive routing protocols of MANETs using group mobility model. In 2009 International Conference on Signal Processing Systems (pp. 192-195). IEEE. 18. Sysel, M. (2011, July). Matlab/simulink tcp/ip communication. In Proceedings of the 15th WSEAS international conference on Computers (pp. 71-75). 19. HARDING, C., Griffiths, A., & Yu, H. (2006). Delay Algorithm for WNCS over MANETs in MATLAB and SIMULINK. 20. NS (simulator) https://en.wikipedia.org/wiki/Ns (simulator) CHAPTER 8 CASE STUDIES AND SAMPLE CODES Abstract In this chapter, we provide detailed explanations of various real-time example case studies taken from various real-time situations along with sample codes and result analysis for better understanding of how MATLAB performed in these situations along with detailed solutions to critical simulation problems. Keywords: Case study, sample code, real-time example Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright 291 292 CASE STUDIES AND SAMPLE CODES In the humanistic systems and life sciences, a relevant examination is an investigation methodology from beginning to end, as well as the calculation of the study case step by step and, moreover, its relevant intelligent aspects. Legitimate examinations have the option of planning by means of the consequent perceived investigative method. The previously mentioned significant examinations are probably going to come into view in exact analysis settings in production and publication as well as major social events. In doing relevant investigations, the “condition” of the creature considered might survive a personality, affiliation, occurrence or movement. On the other hand, real development in an express moment in time just as required. Nevertheless, whenever “condition” is utilized in a sensible manner, while declaring a suggestion or a conflict, such a condition can be susceptible to numerous examined systems, not now relevant to the investigation. Logical examinations may incorporate both abstract and quantitative research strategies. Ridder (similarly, moreover, Welch et al.) [3] perceives four general relevant examination paths. Initially we need to consider the hypothesis which is a kind of significance property to examine the plan and which will be in continuous connectivity with other entities. By following Yin’s guidelines as well as developing positivist doubts, the second sort of research setup is based on “gaps and openings.” A third arrangement is social advancement to present authenticity, which is addressed by Stake. Lastly, the clarification behind logical examination research can in like manner be to perceive “anomalies.” A specialist in this approach is Burawoy. Each one of these four strategies have their own zones of utilization. There are significant methodological complexities between these approaches. Other than that these examination systems are completely different in nature; “applicable examination” can in addition imply an instructional philosophy. 8.1 Case Determination and Structure A common or ordinary case, is once in a while not the most extravagant in information. By the past experience and the explanation regarding the things which are associate, it is very important to identify and pick a responsible identity which can chanve the game plan by enlightening it. A condition confirmation with the end goal that depends upon exemplification decides now and then can make these sorts of bits of learning. While picking a case for an important examination, agents will consequently use data orchestrated testing, instead of optional share. The condition may be chosen, because of the common vitality of the envelope or else the conditions constant it. Sometimes the clients require the meaning of the context they required and the information will be provided by the experts cannot be understandable by the clients all the time. We need to retrieve the information from the experts based on the past experiences and the information we provide will help the people to identify the semanticness in the context. Key cases, anomaly cases and nearby learning cases are the three kinds of affirmation cases. The topic will be “down to earth, recorded solidarity” throughout which the theoretical purpose of combination of the examinations is individually seen. Request will be the end goal of theoretical main focus CASE DETERMINATION AND STRUCTURE 293 – the consistent bundling. In this way, in the interest of representation, regarding the US affirmation there is a main focus on Korean war power which can be available towards the most responsible work which invokes the responsibility. The purpose is to satisfy the examination of suitable instances or the examples. 8.1.1 Exhibiting Analysis A few issues are normally perceived in a condition where advancing is concerned. They should gather information which may help them in seeing such issues. For this to be absolutely capable, the individual ought to be able to finish a quantifiable glancing over to set up any place the issue is. The previously mentioned way, thus requires that the obvious philosophies will most likely be used in a condition somewhere one needs to arrange an advancing explore. We have few forums which conduct the survey on the examination which will identify the expectations on the things which are needed to be considered foremost. The affiliations need to pick one of the accessible systems so they would have the option to lead their examinations both inside and out. 8.1.2 Case Example For our example, the British Airways affiliation is experiencing some challenges. There have been two or three complaints from customers about specific issues. The few allegations which are being faced by the airlines is that regular postponement of the services which are the highest secured and the services which are onboard by the crew members is not satisfying the customers. The piece of security is to be maintained by the service organization is the main case study by the clients to the air lines. 8.1.3 The Best Strategy The best method for any organization is to maintain the internal audits these kind of audits can help to apply the minimum responsibilities to the workers in the organization to work on the satisfactory things. The things which are needed to be considered are regular surveys. All the customers need only the regular surveys of the organizations to take updating the current scenarios of the services. 8.1.4 Impediment of the Technique On the other hand, diagrams furthermore have awful checks. One of the drawbacks is how their arrangement is inflexible. This is by virtue of the examination that the association uses from the soonest beginning stage, and also its association, which can’t be changed all through the route toward party data that is significant. On occasion, the diagram questions are normally tasteless since the association will be constrained to create things that will be used by the entire combination of clients. 294 CASE STUDIES AND SAMPLE CODES 8.1.5 Sorts of Contextual Investigations In advertising research, these sorts of contextual analyses are utilized: 1. Process-arranged 2. Grounded Contextual investigation has a few subdivisions of classification, every one of which is uniquely chosen to address the objectives of the specialist. These kinds of contextual investigations incorporate the following examinations: Illustrative logical examinations: These serve in a general sense to make the unmistakable and to give per the clients’ needs a run-of-the-mill language about the subject being alluded to. Exploratory (or pilot) relevant examinations: These are extensive relevant examinations performed before realizing a broad-scale examination. Their principal limit is to help recognize addresses and select sorts of estimation prior to essential examination. Cumulative relevant examinations: These serve to add up information from a couple of regions assembled with various events. The concept behind these examinations is that aggregating former examinations and mulling over their more conspicuous theories avoids adding extra cost or time utilized on conceivably strange and excess examinations. Important event logical examinations: All feedback is one domain oriented, which means to analyze the condition of hypothesis cases or to deal with comprehensive output. Ultimately this method is quite useful in getting final output. 8.1.6 Relevant Examinations in Business This relevant example related to business states that the scenario in 1870s at Harvard Law school. Christopher is the person who left from the location with leaving some of the coordinates which explains some of the laws which are contrast to the existing scenarios. Research in business orders is generally in context of positivism as epistemology, to be precise, that a real target can be found and gotten a handle on by an intelligible examination of observational confirmation. Regardless, genuine direct can’t simply be suitably reduced to key tests that end up being significant or false. The main thing of the business dealings is to reach the goal state with some profit. For this kind of things we need to maintain refreshments in the rules and the services. The connection between the client and company has to be healthy and the standards which are created must be useful for the clients and the significant reasons. 8.1.7 Summing Up from Logical Investigations An essential case is described as having indispensable centrality in association with the general issue. An essential case allows going with the sort of hypothesis: “In CASE DETERMINATION AND STRUCTURE 295 case it is significant for the above condition, it is true blue for all (or several) conditions.” The theory will run because of its pessimistic edge: “In case it isn’t generous for the condition which is mentioned above, after that it isn’t authentic for any (or considerable for only few) conditions.” One of the principles behind the scientific method is that any scientific hypothesis and resultant experimental design must be inherently falsifiable, known as twisting, which was proposed by Karl Popper. Popper himself used the now acclaimed representation: “All swans are white,” as well as suggested that a single impression of a lone black swan would misshape the above suggestion, and by the means mentioned above would include general centrality as well as enable energized examinations as well as speculation building. Due to the fact that a relevant investigation is proper for recognizing “black swans” because of its all around access, what seems to be “white” as often as not on closer inspection is “black.” Galileo Galilei’s rejection of Aristotle’s law of gravity was not based on a wide range of logical examinations carried out in some numbers but primarily consisted first of a conceptual experiment and then a practical one. In his preliminary consideration, Galileo mulled over the following theory: If two objects of comparative weight are simultaneously dropped from the same height they will hit the ground at the same time, having fallen at the same speed. The only way to avoid any contradiction in this theory was to eliminate weight as a determining factor for acceleration in free fall. Galileo’s experimentalism did not involve a large random number of sample trials of objects falling from a broad assortment of randomly chosen heights under fluctuating wind conditions, and so forth. Or then again, perhaps it included a single examination, that is, a contextual analysis. 8.1.8 History Unmistakable roots start from the mid-twentieth century, when specialists working in the controls of human science, cerebrum research, and human examinations started pushes the things before the examinations. The understandable nature of the sensible examinations are identified the correctness by examining the theories behind the hypothesis. There will be basic level of hypothesis we follow and the scenarios will be significant related to the examinations. These examinations will be helpful for the planning the new estimations related to the tasks of the service. The issue-based learning (PBL) headway gives a layout. By the utilization of (non-business) rule like ace progress, legitimate examinations are routinely recommended as essential events. Close consistent examinations have wound up being more popular in humanism, game plan, and planning research. One methodology urges analysts to consider a dimension plane, vertically, and transitorily. 8.1.9 Related Vocations Applicable examinations are utilized to get some information about movements from their utilization in instructing, where they are generally called case methods and case- 296 CASE STUDIES AND SAMPLE CODES book systems. Extra basic documentation, for example, money-related explanations, courses of occasions, and short histories, once in a while are recommended for the situation social media information related to the organizations and managing those kind of stuff can help the organization to grow and the introduction related to the organization will reflect in the social media page of the organization. Additionally, preparing consistent examinations has wound up being progressively extraordinary in science courses. The national centre for the case studies in the teaching science has fabricated in making the opportunity to work like together working and there is a possibility of the open book system for the examinations which are used for the knowledge identification from the students and also helps the organization for better teaching. 8.2 Case Study 1: Gas Online This case demonstrates how to naturally produce an mbcmodel venture for the gas contextual analysis utilizing the charge line apparatuses in MBC Toolbox (ModelBased Calibration Toolbox).1 Requires DIVCP_Main_DoE_Data.xls from mbctraining folder. 8.2.1 Load Data into Project Create a New mbcmodel Project 1 venture = mbcmodel.CreateProject; Group information within tests as well as include a few channels. Add channels to evacuate bad information. Remove tests which don’t have adequate information to fit nearby models. 8.2.2 Construct Boundary Models Make a worldwide limit demonstrate. CreateBoundary generates without the addition of limit model to the tree. 1 2 3 4 5 6 7 8 9 B=CreateBoundary(testplan Boundary,Global,Star-formed); %.................................................................. % Add limit model to the test plan.The limit display is fitted when % it is added to the limit show tree.The limit demonstrate is % incorporated into the best limit show for the tree as a matter % of course. All information sources are utilized in the limit show % as a matter of course. %.................................................................. B=Add(testplan.Boundary.Global.B); 1 https://www.mathworks.com/products/mbc.html CASE STUDY 1: GAS ONLINE 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 297 %.................................................................. %Now make a limit demonstrate utilizing just speed and load and add %to the limit tree. %.................................................................. B.ActiveInputs=[true genuine false false]; B=Add(testplan.Boundary.Gloal.B); %.................................................................. %Look at the worldwide limit tree. %.................................................................. Testplan.Boundary.Global Ans= Information:[189x4 double] Models:{[1x1 mbcboundary.Model] [1x1 mbcboundary.Model]} BestModel:[1x1 mbcboundary.Boolean] InBest:[1 1] TestPlan: [1x1 mbcmodel.testplan] 8.2.2.2 Manufacture Responses Fabricate feedback designs where torque, drain temperature as well as remaining division Utilize a sector polynomial spline exhibit condition being torque. Utilize a section polynomial model with datum being drain temperature as well as remaining part. 1 2 3 4 5 6 7 8 9 10 11 12 13 LocalTorque = mbcmodel.CreateModel(’Local Polynomial Spline’,1); LocalTorque.Properties.LowOrder = 2; %.................................................................. % Use the default global model. %.................................................................. GlobalModel = testplan.DefaultModels{2}; CreateResponse(testplan,’BTQ’,LocalTorque,GlobalModel,’Maximum’); %.................................................................. % make exhaust temperature and residual fraction models %.................................................................. LocalPoly = mbcmodel.CreateModel(’Local Polynomial with Datum’,1); CreateResponse(testplan,’EXTEMP’,LocalPoly,GlobalModel,’Linked’); CreateResponse(testplan,’RESIDFRAC’,LocalPoly,GlobalModel,’Linked’); 8.2.2.3 Evacuate Local Outliers Evacuate information if abs(studentized residuals) > 3. It is important to note that an alternate procedure persist utilized in venture Gasoline_project to choose anomalies to expel. 1 2 3 TQ_response = testplan.Responses(1); numTests = TQ_response.NumberOfTests; LocalBTQ = TQ_response.LocalResponses; 298 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 CASE STUDIES AND SAMPLE CODES for tn = 1:numTests %.................................................................. % Find observations with studentized residuals greater than 3 %.................................................................. studentRes=DiagnosticStatistics(LocalBTQ,tn,’Studentized residuals’); potentialOut = abs(studentRes)> 3; if any(potentialOut) %.................................................................. % Don’t update response feature models until end of loop %.................................................................. RemoveOutliersForTest( LocalBTQ, tn, potentialOut , false); end %.................................................................. % get local model for test and look at summary statistics %.................................................................. mdl = ModelForTest(LocalBTQ,tn); if ˜strcmp(mdl.Status,’Not fitted’) LocalStats = SummaryStatistics(mdl); end end Update response features: 1 UpdateResponseFeatures(LocalBTQ); Beginning parallel pool (parpool) utilizing the ’nearby’ profile... Associated with 12 laborers. 8.2.2.4 Make Alternative Response Feature Models Prepare a rundown of competitor designs as well as choose the best one in light of AICc. Step 1: Quadratic Step 2: Cubic Step 3: RBF with a range of focuses Step 4: Polynomial-RBF having a range of focuses To create an alternate design, we can utilize the base model. 1 2 rf=LocalBTQ.ResponseFeatures(1); BaseMOdel=rf(1).Model; Create a quadratic model that utilizes Minimize PRESS to fit, and add it to the rundown. 1 2 3 4 m = BaseModel.CreateModel(’Polynomial’); m.Properties.Order = [2 2 2 2]; m.FitAlgorithm = ’Minimize PRESS’; mlist = {m}; Create a cubic model and add it to the rundown. 1 2 3 m.Properties.Order = [3 3 3 3]; m.Properties.InteractionOrder = 2; mlist{2} = m; CASE STUDY 1: GAS ONLINE 299 Create RBF models with a range of focuses. The most extreme number of focuses is set in the middle determination calculation. 1 2 3 4 5 6 7 8 9 m = BaseModel.CreateModel(’RBF’); Centers = [50 80]; Start = length(mlist); mlist = [mlist cell(size(Centers))]; for i = 1:length(Centers) m.FitAlgorithm.WidthAlgorithm.NestedFitAlgorithm. CenterSelectionAlg.MaxCenters = Centers(i); mlist{Start+i} = m; end Create Polynomial-RBF models with a range of centers. 1 2 3 4 5 6 7 8 9 10 11 m = BaseModel.CreateModel(’Polynomial-RBF’); m.Properties.Order = [2 2 2 2]; Start = length(mlist); mlist = [mlist cell(size(Centers))]; for i = 1:length(Centers) % Maximum number of centers is set in the nested fit algorithm m.FitAlgorithm.WidthAlgorithm.NestedFitAlgorithm. MaxCenters = Centers(i); mlist{Start+i} = m; end Create alternative models for each response feature and select the best model based on AICc. 1 2 criteria = ’AICc’; CreateAlternativeModels( LocalBTQ, mlist, criteria ); Alter Response Feature Models Get the alternative responses for knot and alter models using stepwise regression. 1 2 knot = LocalBTQ.ResponseFeature(1); AltResponse = knot.AlternativeResponses(1); Get the stepwise statistics. 1 2 knot_model = AltResponse.Model; [stepwise_stats,knot_model] = StepwiseRegression(knot_model); Use PRESS to find the best term to change, and toggle the stepwise status of the term with this index. 1 2 [bestPRESS, ind] = min(stepwise_stats(:,4)); [stepwise_stats,knot_model] = StepwiseRegression(knot_model, ind); 8.2.2.5 Get a VIF Measurement Get a VIF measurement: 1 VIF = MultipleVIF(knot_model) Result: 300 1 2 3 4 5 6 7 8 9 10 11 12 13 CASE STUDIES AND SAMPLE CODES VIF = 3.1290 1.2918 1.6841 1.1832 1.3230 2.6617 1.6603 1.3306 1.2856 1.4317 2.6550 8.2.2.6 Get the RMSE Get the RMSE: 1 RMSE = SummaryStatistics(knot_model, ’RMSE’) Result: 1 2 3 RMSE = 5.1578 Change the model to a Polynomial-RBF with a maximum of 10 centers. 1 2 3 4 5 6 7 8 new_knot_model = knot_model.CreateModel(’Polynomial-RBF’); new_knot_model.Properties.Order = [1 1 1 1]; new_knot_model.FitAlgorithm.WidthAlgorithm.NestedFitAlgorithm. MaxCenters = 10; %.................................................................. % Fit the model with current data. %.................................................................. [S,new_knot_model] = new_knot_model.Fit; On the off chance that there were no issues with the progressions at that point refresh the reaction, otherwise you will keep on using the first model. 1 2 3 4 5 if strcmp(new_knot_model.Status,’Fitted’) new_RMSE = SummaryStatistics(new_knot_model,’RMSE’) % Update the response with the new model. UpdateResponse(new_knot_model); end Result: 1 2 3 new_RMSE = 3.5086 8.2.2.7 Plot the Two-Stage Model of Torque against Spark Plot the 5th test 1 2 testToPlot = 5; BTQInputData = TQ_response.DoubleInputData(testToPlot); CASE STUDY 1: GAS ONLINE 3 4 5 6 7 8 9 10 11 12 BTQResponseData = TQ_response.DoubleResponseData(testToPlot); BTQPredictedValue = TQ_response.PredictedValue( BTQInputData ); fig = figure; plot( BTQInputData(:,1), BTQResponseData, ’o’, BTQInputData(:,1), BTQPredictedValue,’-’); xlabel(’spark’); ylabel(’torque’); title(’Test 5’); grid on Figure 8.1 8.2.2.8 Two-stage model of torque against spark. Manufacture Other Responses Manufacture design for deplete temperature as well as lingering portion. Step 1: Transcript exceptions that differ from torque shown. Step 2: Prepare elective designs for every reaction highlighted. Step 3: Organize the output evaluated without MLE. EXTEMP Response 1 2 3 4 5 6 7 EXTEMP = testplan.Responses(2).LocalResponses(1); EXTEMP.RemoveOutliers(OutlierIndices(LocalBTQ)); CreateAlternativeModels(EXTEMP,mlist, criteria); MakeHierarchicalResponse(EXTEMP, false); EXTEMP_RMSE =SummaryStatistics(EXTEMP,{’Local RMSE’, ’Two-Stage RMSE’}) Result: 1 2 3 301 EXTEMP_RMSE = 10.5648 27.9916 302 CASE STUDIES AND SAMPLE CODES RESIDFRAC Response 1 2 3 4 5 6 7 8 9 10 11 12 13 RESIDFRAC = testplan.Responses(3).LocalResponses(1); RESIDFRAC.RemoveOutliers(OutlierIndices(LocalBTQ)); CreateAlternativeModels( RESIDFRAC,mlist, criteria ); ok = MakeHierarchicalResponse( RESIDFRAC, false ); RESIDFRAC_RMSE=SummaryStatistics(RESIDFRAC,{’Local RMSE’, ’Two-Stage RMSE’}) if isgraphics(fig) %.................................................................. % delete figure made during example %.................................................................. delete(fig) end Result 1 2 3 RESIDFRAC_RMSE = 0.0824 0.5596 8.3 Case Study 2 Contextual investigation for a charge card examination framework. This case shows how to create a credit scorecard challenge, holder data, show, and plot binned data information. This case also shows how to fit an ascertained backslide appear, secure a mark for the scorecard show, and choose the possibility of default as well as support the credit scorecard indicate using three particular estimations. 8.3.1 Case 1: Create a Credit Scorecard Dissent To stack the data, we can utilize the CreditCardData.mat record (using a dataset from Refaat 2011 [4]). Obviously, ’ResponseVar’ is fixed to the final segment in the data (’status’ for above situation) as well as the ’GoodLabel’ to the feedback regard having most combine (0 this representation). To take out the quick overview of markers, complement for credit scorecard demonstrates a notable ’CustID’ is the ’IDVar’. Similarly, while not displayed in this representation, while making a credit scorecard question using creditscorecard, you can use the optional name-regard coordinate conflict WeightsVar to show discernment (test) weights [1, 2]. 1 2 3 4 5 6 7 8 9 stackCreditCardData sc = creditscorecard(data,’IDVar’,’CustID’) sc = creditscorecard with properties: GoodLabel: 0 ResponseVar: ’status’ WeightsVar: ’’ VarNames: {1x11 cell} CASE STUDY 2 10 11 12 13 14 15 303 NumericPredictors: {1x6 cell} CategoricalPredictors: {’ResStatus’’EmpStatus’’OtherCC’} BinMissingData: 0 IDVar: ’CustID’ PredictorVars: {1x9 cell} Data: [1200x11 table] Play out some underlying information investigation. Ask about indicator insights for the unmitigated volatile ’ResStatus’ as well as sketch the container data for ’ResStatus.’ 1 bininfo(sc,’ResStatus’) Result: 1 2 3 4 5 6 7 ans=46 table Bin Good Bad Odds WOE InfoValue __________ ____ ___ ______ _________ _________ ’Home Owner’ 365 177 2.0621 0.019329 0.0001682 ’Tenant’ 307 167 1.8383 -0.095564 0.0036638 ’Other’ 131 53 2.4717 0.20049 0.0059418 ’Totals’ 803 397 2.0227 NaN 0.0097738 1 plotbins(sc,’ResStatus’) Figure 8.2 ResStatus plot. For numeric information, a typical initial stage is “fine classing.” With the characterization of a normal lattice, it implies binning the information towards a few containers. To outline this point, utilize the indicator ’CustIncome.’ 1 2 3 cp = 20000:5000:60000; sc = modifybins(sc,’CustIncome’,’CutPoints’,cp); bininfo(sc,’CustIncome’) Result: 1 2 3 4 ans=116 table Bin Good Bad Odds WOE InfoValue _________ ____ ___ _______ _________ __________ ’[-Inf,20000)’ 3 5 0.6 -1.2152 0.010765 304 5 6 7 8 9 10 11 12 13 14 1 CASE STUDIES AND SAMPLE CODES ’[20000,25000)’ 23 16 1.4375 -0.34151 0.0039819 ’[25000,30000)’ 38 47 0.80851 -0.91698 0.065166 ’[30000,35000)’ 131 75 1.7467 -0.14671 0.003782 ’[35000,40000)’ 193 98 1.9694 -0.026696 0.00017359 ’[40000,45000)’ 173 76 2.2763 0.11814 0.0028361 ’[45000,50000)’ 131 47 2.7872 0.32063 0.014348 ’[50000,55000)’ 82 24 3.4167 0.52425 0.021842 ’[55000,60000)’ 21 8 2.625 0.26066 0.0015642 ’[60000,Inf]’ 8 1 8 1.375 0.010235 ’Totals’ 803 397 2.0227 NaN 0.13469 plotbins(sc,’CustIncome’) Figure 8.3 8.3.2 CustIncome plot. Case 2: Binning Information Utilize the auto-binning function to execute programmed binning for each indicator variable, utilizing the defect ’Monotone’ calculation having defect calculation choices. 1 sc = autobinning(sc); A monotonic, in a perfect world straight pattern in the Weight of Evidence (WOE), is attractive for credit scorecards since WOE converts towards direct focuses for a given indicator. We can imagine the WOE patterns by utilizing plot bins. 1 plotbins(sc,sc.PredictorVars) CASE STUDY 2 Figure 8.4 Figure 8.5 Figure 8.6 CustIncome plot. TmAtAddress plot. ResStatus plot. 305 306 CASE STUDIES AND SAMPLE CODES Figure 8.7 8.4 EmpStatus plot. Case Study 3: Random Waypoint Mobility Model In this section, we generate a random waypoint mobility scenario for any number of nodes and animation [13]. We have three files: "test_Execute.m" is the file to run, "Generate_Mobility.m" generates a structure containing all needed information resulting from the random waypoint mobility model, and "test_Animate.m" gives the animation to make sure the mobility is fine. Figure 8.8 Random waypoint mobility model. CASE STUDY 3: RANDOM WAYPOINT MOBILITY MODEL 307 test Execute.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 %.................................................................. %Testing Random Waypoint mobility model. %.................................................................. clear all;clc;close all; s_input = struct(’V_POSITION_X_INTERVAL’,[10 30],...%(m) ’V_POSITION_Y_INTERVAL’,[10 30],...%(m) ’V_SPEED_INTERVAL’,[0.2 2.2],...%(m/s) ’V_PAUSE_INTERVAL’,[0 1],...%pause time (s) ’V_WALK_INTERVAL’,[2.00 6.00],...%walk time (s) ’V_DIRECTION_INTERVAL’,[-180 180],...%(degrees) ’SIMULATION_TIME’,500,...%(s) ’NB_NODES’,20); s_mobility = Generate_Mobility(s_input); timeStep = 0.1;%(s) test_Animate(s_mobility,s_input,timeStep) Generate Mobility.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 function s_mobility = Generate_Mobility(s_input) %.................................................................. %The Random Waypoint mobility model. %.................................................................. global s_mobility_tmp; global nodeIndex_tmp; s_mobility.NB_NODES = s_input.NB_NODES; s_mobility.SIMULATION_TIME = s_input.SIMULATION_TIME; for nodeIndex_tmp = 1:s_mobility.NB_NODES %.................................................................. % Initialize: %.................................................................. s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION = []; previousX = unifrnd(s_input.V_POSITION_X_INTERVAL(1), s_input.V_POSITION_X_INTERVAL(2)); previousY = unifrnd(s_input.V_POSITION_Y_INTERVAL(1), s_input.V_POSITION_Y_INTERVAL(2)); previousDuration = 0; previousTime = 0; Out_setRestrictedWalk_random_waypoint(previousX, previousY,previousDuration,previousTime,s_input); %.................................................................. %Promenade %.................................................................. while (s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end) < s_input.SIMULATION_TIME) if(s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING(end)==false) %.................................................................. % Maintenant c’est le temps d’tre mobile %.................................................................. previousX=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(end); 308 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 CASE STUDIES AND SAMPLE CODES previousY=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(end); previousDuration=s_mobility_tmp.VS_NODE(nodeIndex_tmp). V_DURATION(end); previousTime=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end); Out_setRestrictedWalk_random_waypoint(previousX,previousY, previousDuration,previousTime,s_input); else %.................................................................. %Node is taking a pause: %.................................................................. previousDirection=s_mobility_tmp.VS_NODE(nodeIndex_tmp). V_DIRECTION(end); previousSpeed=s_mobility_tmp.VS_NODE(nodeIndex_tmp). V_SPEED_MAGNITUDE(end); previousX=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(end); previousY=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(end); previousTime=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end); previousDuration=s_mobility_tmp.VS_NODE(nodeIndex_tmp). V_DURATION(end); distance=previousDuration*previousSpeed; %.................................................................. s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end+1,1) = previousTime + previousDuration; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(end+1,1) = (previousX + distance*cosd(previousDirection)); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(end+1,1) = (previousY + distance*sind(previousDirection)); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION(end+1,1) = 0; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(end+1,1)=0; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING(end+1,1) = false; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(end+1,1) = Out_adjustDuration_random_waypoint(s_mobility_tmp. VS_NODE(nodeIndex_tmp).V_TIME(end),unifrnd(s_input. V_PAUSE_INTERVAL(1),s_input.V_PAUSE_INTERVAL(2)),s_input); end end %.................................................................. %To have speed vectors as well rather than %only the scalar value: %.................................................................. nb_speed=length(s_mobility_tmp.VS_NODE(nodeIndex_tmp). V_SPEED_MAGNITUDE); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_X = zeros(nb_speed,1); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_Y = zeros(nb_speed,1); for s = 1:nb_speed speed=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(s); direction = s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION(s); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_X(s) = speed*cosd(direction); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_Y(s) = speed*sind(direction); end %.................................................................. %To remove null pauses: %.................................................................. v_index=s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(1:end-1)==0; CASE STUDY 3: RANDOM WAYPOINT MOBILITY MODEL 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 309 s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(v_index)=[]; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_X(v_index) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_Y(v_index) = []; %.................................................................. %To remove the too small difference at the end, if there is one: %.................................................................. if ((s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end) s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end-1)) < 1e-14) s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(end)=[]; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_X(end) = []; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_Y(end) = []; end s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end)= s_input.SIMULATION_TIME; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(end) = 0; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(end) = 0; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_X(end) = 0; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_Y(end) = 0; s_mobility.VS_NODE(nodeIndex_tmp) = struct(’V_TIME’, s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME,... ’V_POSITION_X’,s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X,.. ’V_POSITION_Y’,s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y,.. ’V_SPEED_X’,s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_X,.. ’V_SPEED_Y’,s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_Y); end clear s_mobility_tmp; clear nodeIndex_tmp; end %.................................................................. function Out_setRestrictedWalk_random_waypoint(previousX,previousY, previousDuration,previousTime,s_input) global s_mobility_tmp; global nodeIndex_tmp; x_tmp = previousX; y_tmp = previousY; time_tmp = previousTime + previousDuration; duration_tmp = Out_adjustDuration_random_waypoint(time_tmp, unifrnd(s_input.V_WALK_INTERVAL(1),s_input.V_WALK_INTERVAL(2)), s_input); direction_tmp = unifrnd(s_input.V_DIRECTION_INTERVAL(1), s_input.V_DIRECTION_INTERVAL(2)); 310 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 CASE STUDIES AND SAMPLE CODES speed=unifrnd(s_input.V_SPEED_INTERVAL(1), s_input.V_SPEED_INTERVAL(2)); distance_tmp = speed*duration_tmp; if (distance_tmp == 0) s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end+1,1) = time_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(end+1,1)=x_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(end+1,1)=y_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION(end+1,1) =direction_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(end+1,1) =speed; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING(end+1,1)=true; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(end+1,1) =duration_tmp; else %.................................................................. %The loop begins: %.................................................................. flag_mobility_finished = false; while (˜flag_mobility_finished) x_dest = x_tmp + distance_tmp*cosd(direction_tmp); y_dest = y_tmp + distance_tmp*sind(direction_tmp); flag_mobility_was_outside = false; if (x_dest > s_input.V_POSITION_X_INTERVAL(2)) flag_mobility_was_outside = true; new_direction = 180 - direction_tmp; x_dest = s_input.V_POSITION_X_INTERVAL(2); y_dest=y_tmp+diff([x_tmp x_dest])*tand(direction_tmp); end if (x_dest < s_input.V_POSITION_X_INTERVAL(1)) flag_mobility_was_outside = true; new_direction = 180 - direction_tmp; x_dest = s_input.V_POSITION_X_INTERVAL(1); y_dest=y_tmp+diff([x_tmp x_dest])*tand(direction_tmp); end if (y_dest > s_input.V_POSITION_Y_INTERVAL(2)) flag_mobility_was_outside = true; new_direction = -direction_tmp; y_dest = s_input.V_POSITION_Y_INTERVAL(2); x_dest=x_tmp+diff([y_tmp y_dest])/tand(direction_tmp); end if (y_dest < s_input.V_POSITION_Y_INTERVAL(1)) flag_mobility_was_outside = true; new_direction = -direction_tmp; y_dest = s_input.V_POSITION_Y_INTERVAL(1); x_dest = x_tmp + diff([y_tmp y_dest])/tand(direction_tmp); end current_distance = abs(diff([x_tmp x_dest]) + 1i*diff([y_tmp y_dest])); current_duration = Out_adjustDuration_random_waypoint( time_tmp,current_distance/speed,s_input); s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_TIME(end+1,1) = time_tmp; CASE STUDY 3: RANDOM WAYPOINT MOBILITY MODEL 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 311 s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_X(end+1,1)=x_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_POSITION_Y(end+1,1)=y_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DIRECTION(end+1,1) = direction_tmp; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_SPEED_MAGNITUDE(end+1,1) = speed; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_IS_MOVING(end+1,1) = true; s_mobility_tmp.VS_NODE(nodeIndex_tmp).V_DURATION(end+1,1) = current_duration; if(flag_mobility_was_outside) time_tmp = time_tmp + current_duration; duration_tmp = duration_tmp - current_duration; distance_tmp = distance_tmp - current_distance; x_tmp = x_dest; y_tmp = y_dest; direction_tmp = new_direction; else flag_mobility_finished = true; end end %the loop ended end end %.................................................................. function duration = Out_adjustDuration_random_waypoint(time, duration,s_input) if ((time+duration) >= s_input.SIMULATION_TIME) duration = s_input.SIMULATION_TIME - time; end end test Animate.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 function test_Animate(s_mobility,s_input,time_step) v_t = 0:time_step:s_input.SIMULATION_TIME; for nodeIndex = 1:s_mobility.NB_NODES %.................................................................. %Simple interpolation (linear) to get the position, anytime. %Remember that "interp1" is the matlab function to use in order to %get nodes’ position at any continuous time. %.................................................................. vs_node(nodeIndex).v_x = interp1(s_mobility.VS_NODE(nodeIndex). V_TIME,s_mobility.VS_NODE(nodeIndex).V_POSITION_X,v_t); vs_node(nodeIndex).v_y = interp1(s_mobility.VS_NODE(nodeIndex). V_TIME,s_mobility.VS_NODE(nodeIndex).V_POSITION_Y,v_t); end %.................................................................. figure; hold on; for nodeIndex = 1:s_mobility.NB_NODES vh_node_pos(nodeIndex) = plot(vs_node(nodeIndex).v_x(1), vs_node(nodeIndex).v_y(1),’*’,’color’,[0.3 0.3 1]); end 312 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 8.5 CASE STUDIES AND SAMPLE CODES title(cat(2,’Simulation time (sec): ’, num2str(s_mobility.SIMULATION_TIME))); xlabel(’X (meters)’); ylabel(’Y (meters)’); title(’Radom Waypoint mobility’); ht = text(min(vs_node(1).v_x),max(vs_node(1).v_y), cat(2,’Time (sec) = 0’)); axis([min(vs_node(1).v_x) max(vs_node(1).v_x) min(vs_node(1).v_y) max(vs_node(1).v_y)]); hold off; for timeIndex = 1:length(v_t); t = v_t(timeIndex); set(ht,’String’,cat(2,’Time (sec) = ’,num2str(t,4))); for nodeIndex = 1:s_mobility.NB_NODES set(vh_node_pos(nodeIndex),’XData’, vs_node(nodeIndex).v_x(timeIndex),’YData’, vs_node(nodeIndex).v_y(timeIndex)); end drawnow; end end Case Study 4: Node localization in Wireless Sensor Network Node localization is one of the main challenges in Wireless Sensor Networks (WSNs) [5-10, 15]. In all sensor network applications, it is important to know the origin of collected data and reported events. Step 1: Initialize the location of target and anchor nodes in WSN in place.m file. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 %.................................................................. place.m %.................................................................. %% Used for setting the location of target and anchor nodes in WSN function [phi,alpha]=place(side,nNodes,nAnchors) %Randomly place target nodes phi=rand(2,nNodes)*side; %Place anchor nodes at fixed locations if nAnchors==4 alpha=[[0.25;0.25] [0.75;0.25] [0.25;0.75] [0.75;.75]]*side; elseif nAnchors==8 alpha=[[0.25;0.25] [0.75;0.25] [0.25;0.75] [0.75;.75]... [0;0] [1;0] [1;1] [0;1]]*side; elseif nAnchors==12 alpha=[[0.25;0.25] [0.75;0.25] [0.25;0.75] [0.75;.75]... [0;0] [1;0] [1;1] [0;1]... [0;0.33] [0;0.66] [0.33;0] [0.66;0]]*side; elseif nAnchors==16 CASE STUDY 4: NODE LOCALIZATION IN WIRELESS SENSOR NETWORK 21 22 23 24 25 26 27 28 29 30 31 32 313 alpha=[[0.25;0.25] [0.75;0.25] [0.25;0.75] [0.75;.75]... [0;0] [1;0] [1;1] [0;1]... [0;0.33] [0;0.66] [0.33;0] [0.66;0] [1;0.33] [1;0.66] [0.33;1] [0.66;1]]*side; elseif nAnchors==20 alpha=[[0.25;0.25] [0.75;0.25] [0.25;0.75] [0.75;.75]... [0;0] [1;0] [1;1] [0;1]... [0;0.33] [0;0.66] [0.33;0] [0.66;0] [1;0.33] [1;0.66] [0.33;1] [0.66;1]... [0;0.5] [0.5;0] [1;0.5] [0.5;1]]*side; end end Figure 8.9 The location of target and anchor nodes in WSN. Step 2: Creates matrix SDPrmse.mat containing RMSE (Root Mean Square Error) for GM-SDP-2 (Gaussian Mixture-Semidefinite Programming), run file export_GM_SDP.m and export_WLS.m. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 %.................................................................. export_GM_SDP.m %.................................................................. %% Creates matrix SDPrmse.mat containing RMSE for GM-SDP-2 %% Two Mode GMM parameters P0=-55; beta=2; d0=1; mu=[-4.36;1.73]; S=length(mu); sigmasq = cat(3,[5.22],[4.09]); tau=[0.37;0.63]; eta=log(sqrt(2*pi).*[sigmasq(:,:,1);sigmasq(:,:,2)]); %.................................................................. %% Constants %.................................................................. side=15;%15m 314 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 CASE STUDIES AND SAMPLE CODES nNodes=100; nAnchorsList=[4 8 12 16 20]; %Target index whose position is to be estimated phiIndex=1; %.................................................................. %% Compute error in estimated target position using GM-SDP-2 %.................................................................. rmse=zeros(1,length(nAnchorsList)); %iterate over all anchor sets for aIndex=1:length(nAnchorsList) disp([’Calculating for nAnchors=’num2str(nAnchorsList(aIndex))]); phiHat=zeros(2,nNodes); phiTrue=zeros(2,nNodes); %100 Monte-Carlo runs for x=1:100 fprintf(’.’); %Create matrix containing target and anchor locations [phi,alpha]=place(side,nNodes,nAnchorsList(aIndex)); %Calculate RSS at every target node [P,˜]=findRSS(phi,alpha,P0,beta,d0,mu,sigmasq,tau); % Estimate position gammasq=zeros(nAnchorsList(aIndex),S); for s=1:1:S gammasq(:,s)=(d0ˆ2)*10.ˆ((P0+mu(s)-P(phiIndex,:))/(5*beta)); end [phiHat(:,x),tauHat]=estimatePos(alpha,gammasq,sigmasq, eta,nAnchorsList(aIndex)); phiTrue(:,x)=phi(:,phiIndex); end %Find RMSE dsq=sum((phiTrue-phiHat).ˆ2); rmse(aIndex)=sqrt(mean(dsq)); fprintf(’ \n’); end %.................................................................. %% Save RMSE as SDPrmse.mat %.................................................................. disp([’RMSE GM_SDP: ’ num2str(rmse)]); SDPrmse(:,1)=rmse; SDPrmse(:,2)=nAnchorsList; save(’SDPrmse.mat’,’SDPrmse’); disp(’Completed.’); export_WLS.m 1 2 3 4 5 6 7 8 %.................................................................. export_WLS.m %.................................................................. %% Creates matrix SDPrmse.mat containing RMSE for WLS %% Two Mode GMM parameters %.................................................................. P0=-55; beta=2; CASE STUDY 4: NODE LOCALIZATION IN WIRELESS SENSOR NETWORK 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 315 d0=1; mu=[-4.36;1.73]; S=length(mu); sigmasq = cat(3,[5.22],[4.09]); tau=[0.37;0.63]; eta=log(sqrt(2*pi).*[sigmasq(:,:,1);sigmasq(:,:,2)]); %.................................................................. %% Constants %.................................................................. side=15;%15m nNodes=100; nAnchorsList=[4 8 12 16 20]; %Target index whose position is to be estimated phiIndex=1; %.................................................................. %% Compute error in estimated target position using WLS %.................................................................. errList=zeros(100,length(nAnchorsList)); for aIndex=1:length(nAnchorsList) disp([’Calculating for nAnchors=’num2str(nAnchorsList(aIndex))]); for y=1:100 fprintf(’.’); %Create matrix containing target and anchor locations [phi,alpha]=place(side,nNodes,nAnchorsList(aIndex)); %Recenter origin to first anchor location phiNew=phi-alpha(:,1); alphaNew=alpha-alpha(:,1); %Calculate RSS at every target node [P,˜]=findRSS(phiNew,alphaNew,P0,beta,d0,mu,sigmasq,tau); %find H,b matrices for WLS d=d0*10.ˆ((P0-P(phiIndex,:))/(10*beta));%find d from RSS tmp=alphaNew(:,2:end)’; H=2*tmp; tmp2=d.ˆ2-d(1).ˆ2; b=sum(tmp.ˆ2,2)-tmp2(2:end)’; %find S matrix for WLS varMat=zeros(100,nAnchorsList(aIndex)); for x=1:100 [P,˜]=findRSS(phiNew,alphaNew,P0,beta,d0,mu,sigmasq,tau); d=d0*10.ˆ((P0-P(phiIndex,:))/(10*beta)); varMat(x,:)=d.ˆ2; end variance=zeros(1,nAnchorsList(aIndex)); for x=1:nAnchorsList(aIndex) variance(x)=mean((varMat(:,x)-mean(varMat(:,x))).ˆ2); end tmp3 = diag(variance(2:end)); S = tmp3+variance(1); %Find estimated position of target using WLS 316 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 CASE STUDIES AND SAMPLE CODES wlsEst=inv(H’*inv(S)*H)*H’*inv(S)*b; %append error for WLS errList(y,aIndex)=(norm(wlsEst-phiNew(:,phiIndex))); end fprintf(’ \n’); end %.................................................................. %% Save RMSE as WLSrmse.mat %.................................................................. WLSrmse(:,1)=sqrt(mean(errList.ˆ2));%WLS RMSE WLSrmse(:,2)=nAnchorsList; disp(WLSrmse(:,1)); save(’WLSrmse.mat’,’WLSrmse’); disp(’Completed.’); Step 3: Creates matrix crlb.mat containing Cramer-Rao Lower Bound (CRLB) for WSN Localization, run file export_crlb.m. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 %.................................................................. export_crlb.m %.................................................................. %% Creates matrix crlb.mat containing Cramer-Rao Lower Bound (CRLB) %% for WSN Localization. Two Mode GMM parameters %.................................................................. P0=-55; beta=2; d0=1; mu=[-4.36;1.73]; S=length(mu); sigmasq = cat(3,[5.22],[4.09]); tau=[0.37;0.63]; eta=log(sqrt(2*pi).*[sigmasq(:,:,1);sigmasq(:,:,2)]); %.................................................................. %% Constants %.................................................................. side=15;%15m nNodes=100; nAnchorsList=[4 8 12 16 20]; %Target index whose position is to be estimated phiIndex=25; %.................................................................. %% Compute CRLB %.................................................................. crlbList=zeros(100,length(nAnchorsList)); for aIndex=1:length(nAnchorsList) disp([’Calculating for nAnchors=’num2str(nAnchorsList(aIndex))]); for x=1:100 fprintf(’.’); %Create matrix containing target and anchor locations [phi,alpha]=place(side,nNodes,nAnchorsList(aIndex)); %Calculate RSS at every target node [d,X]=findRSS(phi,alpha,P0,beta,d0,mu,sigmasq,tau); CASE STUDY 4: NODE LOCALIZATION IN WIRELESS SENSOR NETWORK 37 38 39 40 41 42 43 44 45 46 47 48 49 50 317 %Compute CRLB crlbList(x,aIndex)=findCrlb(tau,mu,sigmasq,phiIndex,phi, alpha,beta,X); end fprintf(’ \n’); end crlb(:,1)=sqrt(mean((crlbList.ˆ2))); crlb(:,2)=nAnchorsList; %.................................................................. %% Save CRLB as crlb.mat %.................................................................. save(’crlb.mat’,’crlb’); disp(’Completed.’); Step 4: Run plot_RMSE.m to plot RMSE vs N. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 %.................................................................. plot_RMSE.m %.................................................................. %% Used for plotting the RMSE of various localization algorithms %% from their .mat files. Load the matrices containing RMSE %.................................................................. load ’crlb.mat’ load ’SDPrmse.mat’ load ’WLSrmse.mat’ %.................................................................. %% Plot RMSE %.................................................................. nAnchorsList=crlb(:,2); crlb=crlb(:,1); SDPrmse=SDPrmse(:,1); WLSrmse=WLSrmse(:,1); figure; xq = 0:0.1:max(nAnchorsList); vq = interp1(nAnchorsList,crlb,xq,’v5cubic’); plot(xq,vq,’color’,[1 0 0]);hold on; xq = 0:0.1:max(nAnchorsList); vq = interp1(nAnchorsList,SDPrmse,xq,’v5cubic’); plot(xq,vq,’color’,[0 0 1]); xq = 0:0.1:max(nAnchorsList); vq = interp1(nAnchorsList,WLSrmse,xq,’v5cubic’); plot(xq,vq,’color’,[0 1 0]); %.................................................................. %% Plot formating %.................................................................. legend(’CRLB’,’GM-SDP-2’,’WLS’); scatter(nAnchorsList,crlb,’red’,’filled’); scatter(nAnchorsList,SDPrmse,’blue’,’filled’); scatter(nAnchorsList,WLSrmse,’green’,’filled’); xlabel(’N’);ylabel(’RMSE (m)’); title(’RMSE v/s number of anchors’); axis([4 20 0 12]);grid on; 318 CASE STUDIES AND SAMPLE CODES Step 5: Run export_CDF_GM_SDP.m, and export_CDF_WLS.m to generate .mat files for CDF. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 %.................................................................. export_CDF_GM_SDP.m %.................................................................. %% Creates matrix SDPrmse.mat containing RMSE for GM-SDP-2 %% Two Mode GMM parameters %.................................................................. P0=-55; beta=2; d0=1; mu=[-4.36;1.73]; S=length(mu); sigmasq = cat(3,[5.22],[4.09]); tau=[0.37;0.63]; eta=log(sqrt(2*pi).*[sigmasq(:,:,1);sigmasq(:,:,2)]); %.................................................................. %% Constants %.................................................................. side=15;%15m nNodes=100; nAnchorsList=[4 8 12 16 20]; %Target index whose position is to be estimated phiIndex=1; %.................................................................. %% Compute error in estimated target position using GM-SDP-2 %.................................................................. rmse=zeros(1,length(nAnchorsList)); %iterate over all anchor sets for aIndex=1:length(nAnchorsList) disp([’Calculating for nAnchors=’num2str(nAnchorsList(aIndex))]); phiHat=zeros(2,nNodes); phiTrue=zeros(2,nNodes); %100 Monte-Carlo runs for x=1:100 fprintf(’.’); %Create matrix containing target and anchor locations [phi,alpha]=place(side,nNodes,nAnchorsList(aIndex)); %Calculate RSS at every target node [P,˜]=findRSS(phi,alpha,P0,beta,d0,mu,sigmasq,tau); % Estimate position gammasq=zeros(nAnchorsList(aIndex),S); for s=1:1:S gammasq(:,s)=(d0ˆ2)*10.ˆ((P0+mu(s)-P(phiIndex,:))/(5*beta)); end [phiHat(:,x),tauHat]=estimatePos(alpha,gammasq,sigmasq,eta, nAnchorsList(aIndex)); phiTrue(:,x)=phi(:,phiIndex); end %.................................................................. %Find RMSE CASE STUDY 4: NODE LOCALIZATION IN WIRELESS SENSOR NETWORK 54 55 56 57 58 59 60 61 62 63 64 65 66 67 319 %.................................................................. dsq=sum((phiTrue-phiHat).ˆ2); rmse(aIndex)=sqrt(mean(dsq)); fprintf(’ \n’); end %.................................................................. %% Save RMSE as SDPrmse.mat %.................................................................. disp([’RMSE GM_SDP: ’ num2str(rmse)]); SDPrmse(:,1)=rmse; SDPrmse(:,2)=nAnchorsList; save(’SDPrmse.mat’,’SDPrmse’); disp(’Completed.’); export_CDF_WLS.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 %.................................................................. export_CDF_WLS.m %.................................................................. %% Creates matrix wlsCDF.mat containing CDF for weighted least %% square (WLS). Two Mode GMM parameters %.................................................................. P0=-55; beta=2; d0=1; mu=[-4.36;1.73]; S=length(mu); sigmasq = cat(3,[5.22],[4.09]); tau=[0.37;0.63]; eta=log(sqrt(2*pi).*[sigmasq(:,:,1);sigmasq(:,:,2)]); %.................................................................. %% Constants %.................................................................. side=15;%15m nNodes=100; %nAnchorsList=[4 8 12 16 20]; nAnchorsList=[20]; %.................................................................. %% Compute error %.................................................................. for aIndex=1:length(nAnchorsList) disp([’Calculating for nAnchors=’num2str(nAnchorsList(aIndex))]); phiHat=zeros(2,nNodes); phiTrue=zeros(2,nNodes); %loop over all the target nodes for x=1:100 fprintf(’.’); %Create matrix containing target and anchor locations [phi,alpha]=place(side,nNodes,nAnchorsList(aIndex)); %Recenter origin to first anchor location phiNew=phi-alpha(:,1); alphaNew=alpha-alpha(:,1); %Calculate RSS at every target node 320 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 CASE STUDIES AND SAMPLE CODES [P,˜]=findRSS(phiNew,alphaNew,P0,beta,d0,mu,sigmasq,tau); %find H,b matrices for WLS d=d0*10.ˆ((P0-P(x,:))/(10*beta));%find d from RSS tmp=alphaNew(:,2:end)’; H=2*tmp; tmp2=d.ˆ2-d(1).ˆ2; b=sum(tmp.ˆ2,2)-tmp2(2:end)’; %find S matrix for WLS varMat=zeros(100,nAnchorsList(aIndex)); for i=1:100 [P,˜]=findRSS(phiNew,alphaNew,P0,beta,d0,mu,sigmasq,tau); d=d0*10.ˆ((P0-P(x,:))/(10*beta)); varMat(i,:)=d.ˆ2; end variance=zeros(1,nAnchorsList(aIndex)); for i=1:nAnchorsList(aIndex) variance(i)=mean((varMat(:,i)-mean(varMat(:,i))).ˆ2); end tmp3 = diag(variance(2:end)); S = tmp3+variance(1); %Find estimated position of target using WLS phiHat(:,x)=inv(H’*inv(S)*H)*H’*inv(S)*b; phiTrue(:,x)=phi(:,x); end %Find error in position dsq=sum((phiTrue-phiHat).ˆ2); d=sqrt(dsq); end %.................................................................. %% Save CDF as wlsCDF.mat %.................................................................. acc = 0.5;%round off to nearest 0.5 x = round(d/acc)*acc; a = unique(x); frequency = histc(x(:),a); wlsCDF(:,1)=cumsum(frequency)./sum(frequency); wlsCDF(:,2)=a; save(’wlsCDF.mat’,’wlsCDF’); disp(’Completed.’); Step 6: Run plot_CDF.m to plot CDF vs error. 1 2 3 4 5 6 7 %.................................................................. plot_CDF.m %.................................................................. %% Used for plotting the CDF of various localization algorithms from %% their .mat files. Load the matrices containing CDF %.................................................................. load ’wlsCDF.mat’ CASE STUDY 4: NODE LOCALIZATION IN WIRELESS SENSOR NETWORK 8 9 10 11 12 13 14 15 16 17 18 19 321 load ’sdpCDF.mat’ %.................................................................. %% Plot CDF %.................................................................. figure; plot(sdpCDF(:,2),sdpCDF(:,1),’Marker’,’.’,’MarkerSize’,20); title(’CDF’);xlabel(’Error (in m)’);ylabel(’CDF’); grid on;hold on; plot(wlsCDF(:,2),wlsCDF(:,1),’Marker’,’.’,’MarkerSize’,20); title(’CDF’);xlabel(’Error (in m)’);ylabel(’CDF’); legend(’GM-SDP-2’,’WLS’); File pathLossModel.m: Plot the path loss model and the histogram of the Gaussian Mixture Model. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 %.................................................................. %% Plot the path loss model and the histogram of the Gaussian %% Mixture Model Logarithmic fitting parameters %.................................................................. P0=-55; beta=2; d0=1; %.................................................................. %% GMM parameters %.................................................................. mu=[-4.36;1.73]; sigmasq = cat(3,[5.22],[4.09]); tau=[0.37;0.63]; %.................................................................. %% Path loss model %.................................................................. d=[0.5:0.1:10]’; P=P0-10*beta*log10(d/d0); % For reproducibility rng(’default’); gm = gmdistribution(mu,sigmasq,tau); %Noise with GMM distribution n = random(gm,length(d)); %Received Signal Strength RSS=P+n; %.................................................................. %% Plotting %.................................................................. figure;subplot(1,2,1); scatter(d,P,’filled’,’red’);hold on; scatter(d,RSS,’filled’,’black’);hold off; axis([0 10 -80 -45]);grid on; title(’Fig.1(a) Simulated Path Loss Model’); xlabel(’distance(m)’);ylabel(’RSS (dBm)’); legend(’logarithmic fitting’,’RSS measurement’); subplot(1,2,2); hist(random(gm,3000),175);hold on; xlim([-50 25]); 322 42 43 44 45 CASE STUDIES AND SAMPLE CODES title(’Fig.1(b) Histogram of Simulated RSS noise modelled as Gaussian Mixture’); xlabel(’Noise(dBm)’);ylabel(’Frequency counts’);grid on; legend(’Simulated RSS noise’); File estimatePos.m: Returns the estimated target position using SDP (Semidefinite Programming) in CVX. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 %.................................................................. %% Returns the estimated target position using SDP in CVX %.................................................................. function [phiHat,tauHat]=estimatePos(alpha,gammasq,sigmasq,eta, nAnchors) alphaSqSum=sum((alpha.ˆ2),1); cvx_begin sdp quiet variable capPsi(2,2) symmetric variables x(nAnchors) y(nAnchors) phiHat(2,1) tauHat(2,nAnchors) xi(nAnchors,2) minimize(norm(x,1)+norm(y,1)) subject to for i=1:nAnchors sum(tauHat(:,i))==1%C1 for s=1:2 tauHat(s,i)>=0%C2 tauHat(s,i)<=1%C2 trace(capPsi)-2*phiHat’*alpha(:,i)+alphaSqSum(i)<= gammasq(i,s)*sigmasq(:,:,s)*xi(i,s)%C4 [ trace(capPsi)-2*phiHat’*alpha(:,i)+alphaSqSum(i) sqrt(gammasq(i,s)/sqrt(sigmasq(:,:,s))); ... sqrt(gammasq(i,s)/sqrt(sigmasq(:,:,s))) xi(i,s)] >= 0%C5 end %.................................................................. %norm(phiHat-alpha(:,i),2)>0 %.................................................................. [ capPsi phiHat; ... phiHat’ 1 ] >= 0%C6 x(i)>=trace(tauHat(:,i)*eta’)%C7 y(i)>=sum(xi(i,:))%C8 end cvx_end; end File findCrlb.m: Returns CRLB (Cramer-RaoLowerBound) for a particular target and anchor placement. 1 2 3 4 5 6 7 8 9 10 %.................................................................. %% Returns CRLB for a particular target and anchor placement %.................................................................. function [crlb]=findCrlb(tau,mu,sigmasq,phiIndex,phi,alpha,beta,X) In=monteCarloInt(tau,mu,sigmasq,X); I=zeros(2); %iterate over first dimension in 2D plane for v=1:2 %iterate over second dimension in 2D plane CASE STUDY 4: NODE LOCALIZATION IN WIRELESS SENSOR NETWORK 11 12 13 14 15 16 17 18 19 20 21 22 323 for r=1:2 Num=(phi(v,phiIndex)-alpha(v,:)).*(phi(r,phiIndex)-alpha(r,:)); Dem=(sum(((repmat(phi(:,phiIndex),1,length(alpha))-alpha).ˆ2),1)).ˆ2; %Terms of the Fisher Information Matrix I(v,r)=((10*beta)/(log(10)))ˆ2*In*sum(Num./Dem); end end %.................................................................. %CRLB from Fisher Information Matrix %.................................................................. crlb=sqrt(trace(Iˆ-1)); end File findRSS.m: Returns the Received Signal Strength (RSS) at all target nodes in a WSN. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 %.................................................................. %% Returns the Received Signal Strength (RSS) at all target nodes % in a WSN %.................................................................. function[P,X]=findRSS(phi,alpha,P0,beta,d0,mu,sigmasq,tau) [˜,nNodes]=size(phi); [˜,nAnchors]=size(alpha); gm = gmdistribution(mu,sigmasq,tau); % rng(’default’); % For reproducibility d=zeros(nNodes,nAnchors); %.................................................................. %Distance between jth target and ith anchor %.................................................................. for i=1:nNodes d(i,:)=sqrt(sum((repmat(phi(:,i),1,nAnchors)alpha(:,1:nAnchors)).ˆ2)); end X = random(gm,nNodes*nAnchors); %Noise n = reshape(X,[nNodes,nAnchors]); %Path Loss Model P=P0-10*beta*log10(d./d0)+n; end File monteCarloInt.m: Returns the value of Monte Carlo integration used in calculating the Fisher information matrix. 1 2 3 4 5 6 7 8 9 10 11 %.................................................................. %% Returns the value of monte-carlo integration used in calculating %% the fisher information matrix %.................................................................. function [In] = monteCarloInt(tau,mu,sigmasq,X) %Contains samples of noise from GMM n = sort(X); p1 = tau(1)*(1/(sqrt(2*pi*sigmasq(:,:,1)))) *exp(-(n-mu(1)).ˆ2/(2*sigmasq(:,:,1))); p2 = tau(2)*(1/(sqrt(2*pi*sigmasq(:,:,2)))) *exp(-(n-mu(2)).ˆ2/(2*sigmasq(:,:,2))); 324 12 13 14 15 16 17 18 19 20 21 22 CASE STUDIES AND SAMPLE CODES %PDF of the GMM p=p1+p2; gradp1 = -p1.*(n-mu(1))/sigmasq(:,:,1); gradp2 = -p2.*(n-mu(2))/sigmasq(:,:,2); %PDF of the derivative of the GMM gradp=gradp1+gradp2; f=(gradp.*gradp)./p; In=mean(f)*range(n); end The result: Figure 8.10 (a) Simulated path loss model; (b) Histogram of simulated RSS noise modeled as Gaussian mixture. Figure 8.11 RMSE vs N (number of anchors). CASE STUDY 5: LEACH ROUTING PROTOCOL FOR A WSN Figure 8.12 8.6 325 CDF vs error. Case Study 5: LEACH Routing Protocol for a WSN LEACH (Low energy adaptive clustering hierarchy) [11, 12, 14-17] is a hierarchical protocol in which most nodes transmit to cluster-heads, and the cluster-heads aggregate and compress the data and forward it to the base station (sink). Each node uses a stochastic algorithm at each round to determine whether it will become a clusterhead in this round. LEACH assumes that each node has a radio powerful enough to directly reach the base station or the nearest cluster-head, but that using this radio at full power all the time would waste energy. Nodes that have been cluster-heads cannot become cluster-heads again for P rounds, where P is the desired percentage of cluster-heads. Thereafter, each node has a 1/P probability of becoming a cluster-head in each round. At the end of each round, each node that is not a cluster-head selects the closest cluster head and joins that cluster. The cluster-head then creates a schedule for each node in its cluster to transmit its data. Figure 8.13 Cluster formation in LEACH. 326 CASE STUDIES AND SAMPLE CODES All nodes that are not cluster-heads only communicate with the cluster-head in a TDMA fashion, according to the schedule created by the cluster-head. They do so using the minimum energy needed to reach the cluster head, and only need to keep their radios on during their time slot. LEACH also uses CDMA so that each cluster uses a different set of CDMA codes, to minimize interference between clusters. As described earlier, the operation of LEACH consists of several rounds with two phases in each round. Working of LEACH starts with the formation of clusters based on the received signal strength. The algorithm for LEACH protocol is as follows: The first phase of LEACH is setup phase and the second is steady-state phase. Setup and steady-state are the two main phases in the protocol. In setup phase sensor nodes organize into local cluster where cluster-head is declared based on energy, probability function. Rule-based selection of cluster-head is done as follows: T (n) = ⎧ ⎨ ⎩ p 1−p(r mod , n∈G ) 0, otherwise 1 p (8.1) where p is desired percentage of cluster-heads, r is current round and G is set of sensor nodes which were not cluster-head for last 1/p rounds. The startup and setup phase algorithms for LEACH are as follows [18]: Algorithm 8.1 Setup phase BEGIN Step 1. Start round r = 0; Step 2. All the sensor nodes have the probability of becoming clusterhead; Step 3. For round r, after node is elected as cluster-head, it will start broadcasting ’Hello’ message to nodes in a cluster; Step 4. Energy used to broadcast message is equal for all the clusterheads; Step 5. Initially, all the nodes that are not cluster-head are supposed to keep their receiver ON to receive broadcasted message; Step 6. For round r, non-cluster-head nodes will choose the cluster based on minimum energy criteria required to transmit/receive messages/data; Step 7. Random selection of cluster-head will be done if more numbers of nodes declare themselves as cluster-head. END CASE STUDY 5: LEACH ROUTING PROTOCOL FOR A WSN 327 Algorithm 8.2 Steady-state phase BEGIN Step 1. Non-cluster-head node informs cluster-head about its presence in that cluster; Step 2. Cluster-head will have list of members in cluster due to step 1; Step 3. Cluster-head schedules communication of non-cluster-head nodes with itself based on TDMA; Step 4. The scheme is used to minimize power consumption in noncluster-head nodes. Transmitter is switched off; Step 5. Data aggregation is done by cluster-head after collecting data from non-cluster-head nodes; Step 6. Cluster-head finally transmits the same to base station. END Figure 8.14 Steady-state phase in LEACH. CODE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 close all; clear; clc; %.................................................................. % Network Establishment Parameters % Area of Operation % Field Dimensions in meters %.................................................................. xm=100; ym=100; % added for better display results of the plot x=0; % added for better display results of the plot y=0; % Number of Nodes in the field % n=100; % Number of Dead Nodes in the beggining % dead_nodes=0; % Coordinates of the Sink (location is predetermined in % this simulation) % 328 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 CASE STUDIES AND SAMPLE CODES sinkx=50; sinky=200; %.................................................................. % Energy Values %%% % Initial Energy of a Node (in Joules) % %.................................................................. % units in Joules Eo=2; % Energy required to run circuity (both for transmitter and % % receiver) units in Joules/bit Eelec=50*10ˆ(-9); ETx=50*10ˆ(-9); ERx=50*10ˆ(-9); %.................................................................. % Transmit Amplifier Types %.................................................................. % units in Joules/bit/mˆ2 (amount of energy spent by the amplifier % to transmit the bits) Eamp=100*10ˆ(-12); % Data Aggregation Energy % EDA=5*10ˆ(-9); % units in Joules/bit % Size of data package % k=4000; % units in bits % Suggested percentage of cluster head % % a 5 percent of the total amount of nodes used in the network % is proposed to give good results p=0.05; % Number of Clusters % No=p*n; % Round of Operation % rnd=0; % Current Number of operating Nodes % operating_nodes=n; transmissions=0; temp_val=0; flag1stdead=0; %.................................................................. % End of Parameters % Creation of the Wireless Sensor Network % Plotting the WSN %.................................................................. for i=1:n % sensor’s ID number SN(i).id=i; % X-axis coordinates of sensor node SN(i).x=rand(1,1)*xm; % Y-axis coordinates of sensor node SN(i).y=rand(1,1)*ym; % nodes energy levels (initially set to be equal to "Eo" SN(i).E=Eo; % node acts as normal if the value is ’0’, if elected as % a cluster head it gets the value ’1’ (initially all nodes CASE STUDY 5: LEACH ROUTING PROTOCOL FOR A WSN 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 329 % are normal) SN(i).role=0; % the cluster which a node belongs to SN(i).cluster=0; % States the current condition of the node. when the node is % operational its value is =1 and when dead =0 SN(i).cond=1; % number of rounds node was operational SN(i).rop=0; %rounds left for node to become available for ClusterHead election SN(i).rleft=0; % nodes distance from the cluster head of the cluster in % which he belongs SN(i).dtch=0; % nodes distance from the sink SN(i).dts=0; % states how many times the node was elected as a Cluster Head SN(i).tel=0; % round node got elected as cluster head SN(i).rn=0; %node ID of the cluster head which the "i" normal node belongs to SN(i).chid=0; hold on; figure(1) plot(x,y,xm,ym,SN(i).x,SN(i).y,’ob’,sinkx,sinky,’*r’); title ’Wireless Sensor Network’; xlabel ’(m)’; ylabel ’(m)’; end %.................................................................. % Set-Up Phase %.................................................................. while operating_nodes>0 % Displays Current Round % rnd % Threshold Value % t=(p/(1-p*(mod(rnd,1/p)))); % Re-election Value % tleft=mod(rnd,1/p); % Reseting Previous Amount Of Cluster Heads In the Network % CLheads=0; % Reseting Previous Amount Of Energy Consumed In the Network % on the Previous Round % energy=0; %.................................................................. % Cluster Heads Election %.................................................................. for i=1:n 330 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 CASE STUDIES AND SAMPLE CODES % reseting cluster in which the node belongs to SN(i).cluster=0; % reseting node role SN(i).role=0; % reseting cluster head id SN(i).chid=0; if SN(i).rleft>0 SN(i).rleft=SN(i).rleft-1; end if (SN(i).E>0) && (SN(i).rleft==0) generate=rand; if generate< t % assigns the node role of acluster head SN(i).role=1; % Assigns the round that the cluster head was % elected to the data table SN(i).rn=rnd; SN(i).tel=SN(i).tel + 1; % rounds for which the node will be unable to become a CH SN(i).rleft=1/p-tleft; % calculates the distance between the sink and the cluster hea SN(i).dts=sqrt((sinkx-SN(i).x)ˆ2 + (sinky-SN(i).y)ˆ2); % sum of cluster heads that have been elected CLheads=CLheads+1; % cluster of which the node got elected to be cluster head SN(i).cluster=CLheads; % X-axis coordinates of elected cluster head CL(CLheads).x=SN(i).x; % Y-axis coordinates of elected cluster head CL(CLheads).y=SN(i).y; % Assigns the node ID of the newly elected cluster head to an array CL(CLheads).id=i; end end end % Fixing the size of "CL" array % CL=CL(1:CLheads); %.................................................................. % Grouping the Nodes into Clusters & caclulating the distance % between node and cluster head % %.................................................................. for i=1:n % if node is normal if (SN(i).role==0) && (SN(i).E>0) && (CLheads>0) for m=1:CLheads d(m)=sqrt((CL(m).x-SN(i).x)ˆ2 + (CL(m).y-SN(i).y)ˆ2); % % % % % we calculate the distance ’d’ between the sensor node that is transmitting and the cluster head that is receiving with the following equation+d=sqrt((x2-x1)ˆ2+(y2-y1)ˆ2) where x2 and y2 the coordinates of the cluster head and x1 and y1 the coordinates of the transmitting node CASE STUDY 5: LEACH ROUTING PROTOCOL FOR A WSN 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 331 end % fixing the size of "d" array d=d(1:CLheads); % finds the minimum distance of node to CH [M,I]=min(d(:)); % displays the Cluster Number in which this node belongs too [Row, Col] = ind2sub(size(d),I); % assigns node to the cluster SN(i).cluster=Col; % assigns the distance of node to CH SN(i).dtch= d(Col); SN(i).chid=CL(Col).id; end end %.................................................................. % Steady-State Phase %.................................................................. % Energy Dissipation for normal nodes %.................................................................. for i=1:n if (SN(i).cond==1) && (SN(i).role==0) && (CLheads>0) if SN(i).E>0 ETx= Eelec*k + Eamp * k * SN(i).dtchˆ2; SN(i).E=SN(i).E - ETx; energy=energy+ETx; % Dissipation for cluster head during reception if SN(SN(i).chid).E>0&&SN(SN(i).chid).cond==1&& SN(SN(i).chid).role==1 ERx=(Eelec+EDA)*k; energy=energy+ERx; SN(SN(i).chid).E=SN(SN(i).chid).E - ERx; % if cluster heads energy depletes with reception if SN(SN(i).chid).E<=0 SN(SN(i).chid).cond=0; SN(SN(i).chid).rop=rnd; dead_nodes=dead_nodes +1; operating_nodes= operating_nodes - 1 end end end % if nodes energy depletes with transmission if SN(i).E<=0 dead_nodes=dead_nodes +1; operating_nodes= operating_nodes - 1 SN(i).cond=0; SN(i).chid=0; SN(i).rop=rnd; end end end 332 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 CASE STUDIES AND SAMPLE CODES %.................................................................. % Energy Dissipation for cluster head nodes % %.................................................................. for i=1:n if (SN(i).cond==1) && (SN(i).role==1) if SN(i).E>0 ETx= (Eelec+EDA)*k + Eamp * k * SN(i).dtsˆ2; SN(i).E=SN(i).E - ETx; energy=energy+ETx; end % if cluster heads energy depletes with transmission if SN(i).E<=0 dead_nodes=dead_nodes +1; operating_nodes= operating_nodes - 1 SN(i).cond=0; SN(i).rop=rnd; end end end if operating_nodes<n && temp_val==0 temp_val=1; flag1stdead=rnd end % Display Number of Cluster Heads of this round % %CLheads; transmissions=transmissions+1; if CLheads==0 transmissions=transmissions-1; end % Next Round % rnd= rnd +1; tr(transmissions)=operating_nodes; op(rnd)=operating_nodes; if energy>0 nrg(transmissions)=energy; end end sum=0; for i=1:flag1stdead sum=nrg(i) + sum; end temp1=sum/flag1stdead; temp2=temp1/n; for i=1:flag1stdead avg_node(i)=temp2; end %.................................................................. % Plotting Simulation Results "Operating Nodes per Round" %.................................................................. CASE STUDY 5: LEACH ROUTING PROTOCOL FOR A WSN 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 333 figure(2) plot(1:rnd,op(1:rnd),’-r’,’Linewidth’,2); title ({’LEACH’; ’Operating Nodes per Round’;}) xlabel ’Rounds’; ylabel ’Operational Nodes’; hold on; % Plotting Simulation Results % figure(3) plot(1:transmissions,tr(1:transmissions),’-r’,’Linewidth’,2); title ({’LEACH’; ’Operational Nodes per Transmission’;}) xlabel ’Transmissions’; ylabel ’Operational Nodes’; hold on; % Plotting Simulation Results % figure(4) plot(1:flag1stdead,nrg(1:flag1stdead),’-r’,’Linewidth’,2); title ({’LEACH’; ’Energy consumed per Transmission’;}) xlabel ’Transmission’; ylabel ’Energy ( J )’; hold on; % Plotting Simulation Results % figure(5) plot(1:flag1stdead,avg_node(1:flag1stdead),’-r’,’Linewidth’,2); title ({’LEACH’;’Average Energy consumed by a Node per Transmission’;}) xlabel ’Transmissions’; ylabel ’Energy ( J )’; hold on; The result: Figure 8.15 LEACH simulation. 334 8.7 CASE STUDIES AND SAMPLE CODES Conclusion In this chapter we focused on discussing the different case studies presented in this book. In each chapter we tried to explain different case studies. These case studies will reflect the importance of each chapter. Initially we tried to explain the different case determinations and explanations. After that we explained the different case studies using basic examples. We tried to explain concepts relating to the cases shown in each chapter such as analysis exhibiting, best strategies, technique impediments, contextual implementation, etc. REFERENCES 1. Anderson, R. The Credit Scoring Toolkit. Oxford University Press, 2007. 2. Hillebrand, B., Kok, R. A., & Biemans, W. G. (2001). Theory-testing using case studies: a comment on Johnston, Leach, and Liu. Industrial Marketing Management, 30(8), 651657. 3. Ridder, H. G. (2016). Case Study Research: Approaches, Methods, Contribution to Theory. Rainer Hampp Verlag. 4. Refaat, M. Credit Risk Scorecards: Development and Implementation Using SAS. lulu.com, 2011. 5. Song, L. I. U., & Min, L. U. O. (2007). Analysis of Welch Method in PSE Based on Matlab [J]. Journal of Hubei Institute for Nationalities (Natural Science Edition), 2, 027. 6. Welch, C., Piekkari, R., Plakoyiannaki, E., & Paavilainen-Mntymki, E. (2011). Theorising from case studies: Towards a pluralist future for international business research. Journal of International Business Studies, 42(5), 740-762. 7. Zhang, Y., Xing, S., Zhu, Y., Yan, F., & Shen, L. (2017). RSS-based localization in WSNs using Gaussian mixture model via semidefinite relaxation. IEEE Communications Letters, 21(6), 1329-1332. 8. Gopakumar, A. (2015, September). Node Localization in Wireless Sensor Networks by Artificial Immune System. In 2015 Fifth International Conference on Advances in Computing and Communications (ICACC) (pp. 126-129). IEEE. 9. Heinzelman, W. B., Chandrakasan, A. P., & Balakrishnan, H. (2002). An applicationspecific protocol architecture for wireless microsensor networks. IEEE Transactions on wireless communications, 1(4), 660-670. 10. Heinzelman, W. R., Chandrakasan, A., & Balakrishnan, H. (2000, January). Energyefficient communication protocol for wireless microsensor networks. In Proceedings of the 33rd annual Hawaii international conference on system sciences (pp. 10-pp). IEEE. 11. Aslam, M., Javaid, N., Rahim, A., Nazir, U., Bibi, A., & Khan, Z. A. (2012, June). Survey of extended LEACH-based clustering routing protocols for wireless sensor networks. In 2012 IEEE 14th International Conference on High Performance Computing CONCLUSION 335 and Communication & 2012 IEEE 9th International Conference on Embedded Software and Systems (pp. 1232-1238). IEEE. 12. Tyagi, S., & Kumar, N. (2013). A systematic review on clustering and routing techniques based upon LEACH protocol for wireless sensor networks. Journal of Network and Computer Applications, 36(2), 623-645. 13. Kareem, M. M., Ismail, M., Altahrawi, M. A., Arsad, N., Mansor, M. F., & Ali, A. H. (2019, May). Grid Based Clustering Technique in Wireless Sensor Network using Hierarchical Routing Protocol. In 2018 IEEE 4th International Symposium on Telecommunication Technologies (ISTT) (pp. 1-5). IEEE. 14. Iqbal, A., Akbar, M., Javaid, N., Bouk, S. H., Ilahi, M., & Khan, R. D. (2013). Advanced LEACH: A static clustering-based heteroneous routing protocol for WSNs. arXiv preprint arXiv:1306.1146. 15. Rajaram, M. L., Kougianos, E., Mohanty, S. P., & Choppali, U. (2016). Wireless sensor network simulation frameworks: A tutorial review: MATLAB/Simulink bests the rest. IEEE Consumer Electronics Magazine, 5(2), 63-69. 16. Tong, M., & Tang, M. (2010, September). LEACH-B: an improved LEACH protocol for wireless sensor network. In 2010 6th international conference on wireless communications networking and mobile computing (WiCOM) (pp. 1-4). IEEE. 17. Nayyar, A., Puri, V., & Le, D. N. (2019). Comprehensive analysis of routing protocols surrounding underwater sensor networks (UWSNs). In Data Management, Analytics and Innovation (pp. 435-450). Springer, Singapore. 18. Varshney, S., & Kuma, R. (2018, January). Variants of LEACH Routing Protocol in WSN: A Comparative Analysis. In 2018 8th International Conference on Cloud Computing, Data Science & Engineering (Confluence) (pp. 199-204). IEEE. 19. https://www.mathworks.com/ 20. http://cvxr.com/cvx/ 21. https://github.com/ 336 CASE STUDIES AND SAMPLE CODES Authors Dac-Nhuong Le received a MSc and PhD in computer science from Vietnam National University, Vietnam, in 2009 and 2015, respectively. He is Deputy Head of Faculty of Information Technology, Haiphong University, Vietnam. He has a total academic teaching experience of 12 years with many publications in reputed international conferences, journals and online book chapter contributions (Indexed By: SCI, SCIE, SSCI, ESCI, Scopus, ACM, DBLP). His area of research includes: evaluation computing and approximate algorithms, network communication, security and vulnerability, network performance analysis and simulation, cloud computing, IoT and biomedical image processing. His core work is in the areas of network security, soft computing and IoT and biomedical image processing. Recently, he has been on the Technique Program Committee and Technique Reviews as well as the Track Chair for the following international conferences: FICTA 2014, CSI 2014, IC4SD 2015, ICICT 2015, INDIA 2015, IC3T 2015, INDIA 2016, FICTA 2016, ICDECT 2016, IUKM 2016, INDIA 2017, CISC 2017, FICTA 2018, ICICC 2019, AICI 2020 under Springer-ASIC/LNAI Series. Presently, he is serving on the editorial board of international journals and has authored and edited ten computer science books by Springer, Wiley, CRC Press, Lambert Publication, and Scholar Press. Abhishek Kumar Pandey is pursuing a doctorate in computer science from the University of Madras and is doing ongoing research on face recognition using the IoT concept. He has a Master of Technology in Computer Science and Engineering from Government Engineering College, Ajmer, Rajasthan Technical University, Kota, India. He has been working as an Assistant Professor of Computer Science at Aryabhatt Engineering College and Research Center, Ajmer, and is also a visiting faculty member at Government University MDS Ajmer. He has a total academic teaching experience of more than eight years with many articles published by Wiley, Taylor & Francis, Springer, Elsevier Science Direct, Annals of Computer Science - Poland, and IEEE, listed in the SCOPUS index of national and international journals. His research area includes artificial intelligence, image processing, computer vision, data mining, and machine learning. He has been on the International Conference Committee of many international conferences and has been the reviewer for IEEE and Inderscience journals. He has co-authored three books published internationally and four edited books, and is currently working on a book about machine learning with BPB Publication. He is also affiliated with various Network Modeling, Simulation and Analysis in MATLAB. c 2019 Scrivener Publishing By Dac-Nhuong Le et al. Copyright CONCLUSION 337 national and international professional societies in the field of engineering and research: He is a member of IAENG (International Association of Engineers), ICSES (International Computer Science and Engineering Society), ISOC (Internet Society); associate member of IRED (Institute of Research Engineers and Doctors) and IAIP (International Association of Innovation Professionals); and a life time member of ISRD (International Society for Research and Development). In 2018 he received the Sir C. V. Raman Life Time Achievement National Award in the young researcher and faculty category. He serves as associate editor of Global Journal on Innovation, Opportunities and Challenges in Applied Artificial Intelligence and Machine Learning. Sai Ram Tadepalli completed his Bachelors in Computer Science and Engineering and Masters in Cloud Computing and is pursuing a PhD in Machine Learning from Vellore Institute of Technology. He has a certification in data science from John Hopkins University, USA, and has had various research articles published which can be found among the Scopus Journals and American indexed journals. His primary research is in machine learning implementations in more realtime platforms like social networking and is working on deep learning implementation in online platforms and social media. Pramod Singh Rathore has a Master of Technology in Computer Science and Engineering from Government Engineering College, Ajmer, Rajasthan Technical University, Kota, India. He has been working as the Assistant Professor of Computer Science at Aryabhatt Engineering College and Research Centre, Ajmer, and also as a visiting faculty member at Government University MDS Ajmer. He has authored a book on network simulation published worldwide. He has a total of six years academic teaching experience with many publications in reputed national and internation E-SCI, SCOPUS journals like Wiley, IGI GLOBAL, Taylor & Francis Springer, Elsevier Science Direct, Annals of Computer Science - Poland, and IEEE. His areas of research include NS2, computer network mining, and DBMS. He is on the editorial and advisory committee of Global journal group. 338 CASE STUDIES AND SAMPLE CODES Jyotir Moy Chatterjee is currently working as an Assistant Professor of IT at Lord Buddha Education Foundation (Asia Pacific University of Technology and Innovation), Kathmandu, Nepal. Earlier he worked as an assistant professor in the CSE department at GD Rungta College of Engineering and Technology (Chhattisgarh Swami Vivekananda Technical University), Bhilai, Chhattisgarh. He has a Master of Technology from Kalinga Institute of Industrial Technology, Bhubaneswar, Odisha and a Bachelor of Technology in Computer Science and Engineering from Dr. M.G.R Educational and Research Institute, Chennai. His research interests include cloud computing, big data, privacy preservation, data mining, the Internet of things, and machine learning. He serves as a member of the editorial board of the Science Research Association, was selected as a reviewer for the International Journal of Big Data and Analytics in Healthcare (IGI Global- Scopus) and International Journal of Fuzzy System Applications (IGI Global - Scopus), and served as a program committee member at the FICTA-2018 Special Session on SCML18: Soft Computing and Machine Learning Models for Bio-Medical Applications, Vietnam (Springer). He has reviewed research papers for the Journal of Medical Systems (Springer-SCIE indexed), EAI Endorsed Transactions on Industrial Networks and Intelligent Systems (Scopus indexed), International Conference on Research in Intelligent & Computing in Engineering-2018 (IEEE), Elsevier Cognitive Systems Research journal (Scopus indexed), International Journal of Electrical & Computer Engineering (Scopus indexed), ACM Computing Surveys journal (SCI indexed), and Oriental Journal of Computer Science and Technology (UGC approved). He served as co-convener at the International Multidisciplinary Conference on Emerging Trends in Engineering, Science and Technology 2017 and was selected as a subject expert for Sodh Samiksha Aur Mulyankan Journal (UGC approved). He received Best Paper Award for “Fog Computing - Beginning of a New Era” in PARAS 2017 (Parthivi College of Engineering & Management, Bhilai) and was the winner of Best Concept Movie Award (Short-Film) in Intra College Cultural Fest “CENOZOIC’11” in Chennai.