- 1、本文档共10页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
用C语言生成随机数报告
Name:陈启武 Student number:2014200557 Profession:Microelectronics
Task1:Generate random variates for Gaussian distriubution and draw the corresponding PDFs
The principal:
In probability theory, the normal (or Gaussian) distribution is a very commonly occurring continuous probability distribution. The probability density function of the normal distribution is
The parameter in this definition is the mean or expectation of the distribution (and also its median and mode). The parameter is its standard deviation; its variance is therefore . A random variable with a Gaussian distribution is said to be normally distributed and is called a normal deviate.
b) The method of generating random numbers is to use the 搑and()?function to generate a random number in C++ program firstly, then the generated random number is mapped to the required range.In the text,I generated 10,000 random numbers followed by uniform distribution between the interval [-10,10].
c) We can use the generated random numbers to calculate density function values,these values are the required random numbers for normal distributon. In the test,I defined 搉ormal()?function to generate 10000 idensity function values which have been put in to a text called ?23?.
d) Finally,we must draw the corresponding PDFs to test and verify probability density function values with MATLAB. In the test,I I put the programmed datas into 500 groups and get the different histograms for normal(0,1),(0,4.26),(-2.5,1).
Here抯 the commands of matlab I have used in the test.u
m=load(F:\text\normal\123.txt)
hist(m,500)
Title(‘N(miu,sigma)’)
The C++ source program:
#include math.h
#include stdlib.h
#include time.h
#include fstream
#include iostream
using namespace std;
#define pi 3.1415926
//Generate a randon number followed by uniform distribution between the inteval [min,max]
templatetypename T
T rand(T min, T max)
{
return min+(max-min)*rand()/(RAND_MAX+1.0);
}
//calcu
您可能关注的文档
- 生物化学5 糖类.ppt
- 生物化学3-生物催化剂——酶.pptx
- 生物多样性 biodiversity PPT.pptx
- 生物学之脂类.ppt
- 生物学发光检测法(ATP).ppt
- 生物学词典.doc
- 生物学实验:蛙心期前收缩.ppt
- 生物医学工程概论之生物医学图像_1-part2.ppt
- 生物工程下游技术1.ppt
- 生物文献阅读.ppt
- 2024广东广州市白云区卫生健康系统招聘事业单位工作人员202人(第三批)笔试备考试题及答案解析.docx
- 2024安徽芜湖市人才发展集团代招聘芜湖市民政局所属事业单位招聘编外工作人员12人笔试备考试题及答案解析.docx
- 2024第三季度上海大剧院招聘7人笔试备考试题及答案解析.docx
- 2024福建厦门市思明区所属事业单位简化程序补充编内1人(2024年9月)笔试备考试题及答案解析.docx
- 2024福建三明医疗保障基金中心招聘驻明溪县总医院医保服务站编外2人笔试备考试题及答案解析.docx
- 浙江国企招聘-2024绍兴市镜湖新区城市建设发展有限公司招聘8人笔试备考试题及答案解析.docx
- 浙江国企招聘-2024台州仙居县国有企业公开招聘65人笔试模拟试题及答案解析.docx
- 2024广东清远市人民检察院招聘见习人员6人笔试备考试题及答案解析.docx
- 2024广东深圳市宝安区崛起诚信实验学校急聘小学英语教师1人笔试模拟试题及答案解析.docx
- 2024广东中山市大涌镇人民政府所属事业单位第二期招聘事业单位人员10人笔试模拟试题及答案解析.docx
最近下载
- T∕CHAS 10-2-29-2020 中国医院质量安全管理 第2-29部分:患者服务临床营养(可复制版).pdf
- 统编版语文二年级上册全册大单元整体教学设计.pdf VIP
- 42水平五 啦啦操单元18课时计划-《花球啦啦操组合动作教学及创编》教案.docx VIP
- 业主委员会议事规则.pdf VIP
- 国企招聘:2024中国石油秋季高校毕业生招聘笔试备考试题及答案解析.docx
- 门诊部护理人文关怀.pptx VIP
- 数字音频编辑Adobe Audition实用教程-全套课件.pptx
- 现代控制工程(第五版)卢伯英习题答案解析.pdf
- 沙漠越野基地开发项目建议书.doc VIP
- GB/T 19001-2016 质量管理体系 要求.pdf
文档评论(0)