The purpose of this book is first to study MATLAB programming concepts, then the basic concepts of modeling and simulation analysis, particularly focus on digital communication simulation. The book will cover the topics practically to describe network routing simulation using MATLAB tool. It will cover the dimensions' like Wireless network and WSN simulation using MATLAB, then depict the modeling and simulation of vehicles power network in detail along with considering different case studies.

Key features of the book include:

* Discusses different basics and advanced methodology with their fundamental concepts of exploration and exploitation in NETWORK SIMULATION.

* Elaborates practice questions and simulations in MATLAB

* Student-friendly and Concise

* Useful for UG and PG level research scholar

* Aimed at Practical approach for network simulation with more programs with step by step comments.

* Based on the Latest technologies, coverage of wireless simulation and WSN concepts and implementations

# 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

## 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.

- 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.
- 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 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.

## 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 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** System modeling...