Probability Density Function
显示 更早的评论
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.
回答(1 个)
Tom Lane
2012-5-10
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Noncentral t Distribution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!