scenario generation using pdf

1 Ansicht (letzte 30 Tage)
Reza Khalili
Reza Khalili am 1 Aug. 2021
Bearbeitet: Hari am 3 Sep. 2024
Hi,
I want to make some scenario using a probability distribution function and calculate the probability of each scenario(I need the probability for other executions) but I don't know how exactly. would you please give me some help or suggestions?

Antworten (1)

Hari
Hari am 3 Sep. 2024
Bearbeitet: Hari am 3 Sep. 2024
Hi Reza,
I understand that you want to generate scenarios using a probability distribution function and calculate the probability of each scenario for further executions.
You can follow the below steps to acheive the same:
  • Choose a Probability Distribution: Select a probability distribution function (PDF) for your scenario. For example, let's use a normal distribution.
mu = 0; % Mean of the normal distribution
sigma = 1; % Standard deviation of the normal distribution
pd = makedist('Normal', 'mu', mu, 'sigma', sigma);
  • Generate Random Scenarios: Use the "random" function to generate random scenarios based on the chosen distribution.
numScenarios = 1000; % Number of scenarios
scenarios = random(pd, numScenarios, 1);
  • Calculate Probability of Each Scenario: Use the probability density function to calculate the probability of each generated scenario.
probabilities = pdf(pd, scenarios);
  • Normalize Probabilities: Normalize the probabilities so that their sum equals 1, which is useful for comparing probabilities across different executions.
probabilities = probabilities / sum(probabilities);
  • Visualize Scenarios and Probabilities: Plot the scenarios and their corresponding probabilities to visualize the distribution.
Sample output for the above example:
References:
Hope this helps!

Kategorien

Mehr zu Monte-Carlo finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by