Monte Carlo simulation is a technique used to study how a model responds to randomly generated inputs. It typically involves a three-step process:
- Randomly generate “N” inputs (sometimes called scenarios).
- Run a simulation for each of the “N” inputs. Simulations are run on a computerized model of the system being analyzed.
- 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.