hattrick110 发表于 2009-2-5 09:34

蒙特卡洛方法matlab程序

贴一个蒙特卡洛方法的matlab程序,供大家使用。
祝大家比赛都能取得好成绩:victory:


% Example Monte Carlo Simulation in Matlab
% Function: y = x2^2/x1
%
% Generate n samples from a normal distribution
% r = ( randn(n,1) * sd ) + mu
% mu : mean
% sd : standard deviation
%
% Generate n samples from a uniform distribution
% r = a + rand(n,1) * (b-a)
% a : minimum
% b : maximum
n = 100000; % The number of function evaluations
% --- Generate vectors of random inputs
% x1 ~ Normal distribution N(mean=100,sd=5)
% x2 ~ Uniform distribution U(a=5,b=15)
x1 = ( randn(n,1) * 5 ) + 100;
x2 = 5 + rand(n,1) * ( 15 - 5 );
% --- Run the simulation
% Note the use of element-wise multiplication
y = x2.^2 ./ x1;
% --- Create a histogram of the results (50 bins)
hist(y,50);
% --- Calculate summary statistics
y_mean = mean(y)
y_std = std(y)
y_median = median(y)

mma 发表于 2009-2-5 09:55

多谢拉!!!!!!!

sjtucat5 发表于 2009-2-5 10:01

thankyouverymuch

tzhggx 发表于 2009-6-3 12:53

顶啊!不错啊!

BigTou 发表于 2009-7-21 17:50

谢谢啦...................

rever99 发表于 2009-7-25 04:01

个盲目反卷积程序是用模拟退火法做的,想请教

jafy2009 发表于 2009-8-28 00:08

哈哈哈。。。谢谢!!!

eyehappy 发表于 2009-8-29 10:37

thank you!!!!

cherry_s1218 发表于 2009-8-29 21:06

看看。。。。。。

shuxinjian24134 发表于 2009-9-1 21:29

xinga!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
页: [1] 2 3 4
查看完整版本: 蒙特卡洛方法matlab程序