Modelling 4 PDF

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Course Name: Modelling and Simulations Lab Course Code: CSP-443

Experiment: 4
Aim:
Write a program to implement Monte Carlo Simulation.

Tools/Software Required:
MATLAB

Description:
Monte Carlo Simulation is a method for exploring the sensitivity of a complex system by
varying parameters within statistical constraints.
Common tasks for performing Monte Carlo analysis include:

· Varying uncertain parameters for your model

· Creating dynamic simulations and alter parameters with statistical uncertainty

· Creating a Monte Carlo simulation to model a complex dynamic system

· Distributing simulations between processor cores and individual PCs to speed


analysis

· Analyzing data through robust plotting and advanced statistical methods

Steps:
Step1: establish probability distribution
Step2: cumulative probability distribution.
Step3: setting random number intervals.
Step4: generating random numbers.
Step5: find the solution.

Name: SHASHANK SHARMA UID: 19BCS2707

Implementation:
n_cards = 90000;

a = zeros(1,n_cards);
for n= 1:n_cards

deck = randperm(52);
num_drawn = 3;

draw = deck(1:num_drawn);

count = 0;
for i = 1 : num_drawn

if draw(i) <=12;
count = count+1;

end
end

if count == num_drawn;
a(n) = 1;

else
a(n) = 0;

end
end

s = sum(a);

p = s/n_cards

Name: SHASHANK SHARMA UID: 19BCS2707


Output:

Name: SHASHANK SHARMA UID: 19BCS2707

You might also like