Probability Density Function
7 views (last 30 days)
Show older comments
Hello,
I have a question please: If I have a funcion f(a,b,c,d), how can one assign a certain probability distribution function (e.g. normal distribution) for each of a,b,c,d? The second question is how to calculate the probability density function of f?
Thank you very much.
0 Comments
Answers (1)
Tom Lane
on 10 May 2012
This could be a very complicated question depending on how far you want to take it. Here's a simple attempt. You can simulate values of f by simulating values of its inputs. Then you can compute a histogram of the results. For example:
a = 10 + 2*randn(1000,1); % 1000 normal values, mean 10, std dev 2
b = pi*rand(1000,1); % 1000 values uniform between 0 and pi
f = @(a,b) a.*sin(b); % sample f function
e = f(a,b); % simulate f
hist(e,40); % histogram, similar to density function
This code doesn't make use of any toolbox, but you can find functions to generate random numbers from other distributions in the Statistics Toolbox.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!