# What is Monte Carlo Simulation?

## Perform sensitivity analysis through random parameter variation

Monte Carlo simulation is a technique used to study how a model responds to randomly generated inputs. It typically involves a three-step process:

1. Randomly generate “N” inputs (sometimes called scenarios).
2. Run a simulation for each of the “N” inputs. Simulations are run on a computerized model of the system being analyzed.
3. Aggregate and assess the outputs from the simulations. Common measures include the mean value of an output, the distribution of output values, and the minimum or maximum output value.

Systems analyzed using Monte Carlo simulation include financial, physical, and mathematical models. Because simulations are independent from each other, Monte Carlo simulation lends itself well to parallel computing techniques, which can significantly reduce the time it takes to perform the computation.

### Monte Carlo Simulation in MATLAB

The MATLAB® language provides a variety of high-level mathematical functions you can use to build a model for Monte Carlo simulation and to run those simulations. MATLAB is used for financial modeling, weather forecasting, operations analysis, and many other applications.

In financial modeling, Monte Carlo Simulation informs price, rate, and economic forecasting; risk management; and stress testing. Financial Toolbox™ provides stochastic differential equation tools to build and evaluate stochastic models. Risk Management Toolbox™ facilitates credit simulation, including the application of copula models.

For more control over input generation, Statistics and Machine Learning Toolbox™ provides a wide variety of probability distributions you can use to generate both continuous and discrete inputs.

### Monte Carlo Simulation in Simulink

You can model and simulate multidomain systems in Simulink® to represent controllers, motors, gains, and other components. The design and testing of these complex systems involves multiple steps, including identifying which model parameters have the greatest impact on requirements and behavior, logging and analyzing simulation data, and verifying the system design.

Monte Carlo simulations help you gain confidence in your design by allowing you to run parameter sweeps, explore your design space, test for multiple scenarios, and use the results of these simulations to guide the design process through statistical analysis. Simulink Design Optimization™ provides interactive tools to perform this sensitivity analysis and influence your Simulink model design.

### Running Monte Carlo Simulations in Parallel

To improve the performance of your Monte Carlo simulations, you can distribute the computations to run in parallel on multiple cores using Parallel Computing Toolbox™ and MATLAB Parallel Server™.

See also: formal verification, financial engineering, random number, system verification and validation, Monte Carlo simulation in computational finance, parameter estimation, load forecasting, modeling and simulation, simulation software, Monte Carlo simulation videos, predictive modeling

### How to Make Predictions Using Monte Carlo Simulations

Sensitivity Analysis identifies the influential parameters in your Simulink model to help you explore your design space and improve the performance of design optimization and parameter estimation sessions.