c语言自动生成报告,用C语言生成随机数报告

西南交大信息学院研究生课程《通信建模与仿真》作业分享,方便后来人!!

1-342-png_6_0_0_312_114_638_385_1263.06_1787.22-567-0-1792-567.jpg

Name:陈启武 Student number:2014200557 Profession:Microelectronics

Task1:Generate random variates for Gaussian distriubution and draw the

corresponding PDFs

1、The principal:

1-46-png_6_0_0_197_857_249_53_1263.06_1787.22-221-0-2207-221.jpg

1-13-png_6_0_0_291_943_14_15_1263.06_1787.22-12-0-2288-12.jpg

1-18-png_6_0_0_708_984_21_20_1263.06_1787.22-19-0-2380-19.jpg

a) 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).

. A random variable with a Gaussian The parameter is its standard deviation; its variance is therefore

distribution is said to be normally distributed and is called a normal deviate.

b) The method of generating random numbers is to use the “rand()” 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 “normal()” function to generate 10000 idensity

function values which have been put into a text called ”123” .

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’s the commands of matlab I have used in the test.

m=load('F:\text\normal\123.txt')

hist(m,500)

Title(‘N(miu,sigma)’)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值