Help with Monte Carlo

조회 수: 3 (최근 30일)
Wesser
Wesser 2021년 1월 19일
댓글: Wesser 2021년 1월 19일
Hi all,
I have the following equation:
dCs(t)=(I*Ea/Vd)-(Ke*Cs(t)); % Single compartment Tox model
I would like to run a monte carlo for the following variables:
% Parameters that will be subject to monte carlo
%Vd - Volume of distribution; Normally distributed between 7 and 77
%Ke - Elimination rate; Uniform distrubution between 8 and 88
%I - Intake rate; Log-Normal distribution between 9 and 99
I would like to run 1000 Monte Carlo iterations.
How would I code this? All the examples I've found are a bit complicated for me to understand.
Thanks!
  댓글 수: 2
Walter Roberson
Walter Roberson 2021년 1월 19일
%Vd - Volume of distribution; Normally distributed between 7 and 77
Not possible. Normal distribution is infinite on both sides. Perhaps a beta distribution?
Wesser
Wesser 2021년 1월 19일
Totally fair comment! I was just throwing out different kinds of distribitions becasue I'm not sure what these will be for each variable (I'm not the toxicologist on this project!) . I do know that the variables will be within known ranges and might have different types of distributions. So yes, beta distribution would work as far a this example goes. Thanks for this feedback!

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2021년 1월 19일
For your normal distribution rather than just say it's between 7 and 77, you should give its mean and standard deviation. Then use randn(). Same for the lognormal. Like
numExperiments = 1000;
Vd = 45 + 10 * rand(1, numExperiments);
Ke = 8 + 80 * rand(1, numExperiments);
pd = makedist('Lognormal', 'mu', log(45), 'sigma', 10)
I = random(pd, 1, numExperiments);
dCs = (I * Ea / Vd) - (Ke * Cs);
or something sort of like that. I don't know what t, Cs, and Ea are.
  댓글 수: 1
Wesser
Wesser 2021년 1월 19일
Thanks! This is great :)

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by