Monte Carlo simulation is a technique used to perform sensitivity analysis, that is, 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.
Using Monte Carlo Simulation in MATLAB
MATLAB® provides functions, such as uss and simsd, that 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.
Using 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™.
Resources
Expand your knowledge through documentation, examples, videos, and more.
Discover More
- Developing and Implementing Scenario Analysis Models to Measure Operational Risk - User Story
- Improving System Models Using Monte Carlo Techniques - AIAA Paper
- Monte-Carlo Simulations & Robustness Analysis - File Exchange
- Sensitivity Analysis and Monte Carlo Simulations for an electrical circuit model (5:01) - Video