ECMT2160: Computational

比特星辰客
• 阅读 491

ECMT2160: ComputationalAssignment
Due: November 3, 11:59am
This assessment task requires you to use MATLAB to run some Monte Carlo
simulations. You should prepare your submission as a MATLAB Live Script
file (i.e., a .mlx file). Submit your answers through the Canvas course website.
Your submission should include a mixture of written responses formatted as text,
blocks of MATLAB code, and MATLAB output, including graphs. You should
submit two versions of your answers: the original .mlx file, and a version ex-
ported to .html.
You may work on this assessment individually, or in pairs. If you work in
pairs, it is important that you clearly indicate the student ID number of your
partner in your submission. Your submission should not be identical to your
partner’s submission.
The assignment consists of two questions, each with multiple parts. Answer
all parts of both questions. The assignment is worth a total of 25 points towards
your final assessment. The first question is worth 15 points and the second ques-
tion is worth 10 points. Points will be deducted for poor presentation, including:
excessive typos, poor written expression, poor organization, etcetera.
1
Question 1
Before attempting Question 1, you should work through Sections 3.8 and 3.9 in
the file IntroProb.mlx. Begin your submitted solution to Question 1 by running
the command
rng(STUDENTID)
in MATLAB, where STUDENTID is your 9-digit Student ID number. This fixes
the sequence of random numbers to be generated in your simulation.
Suppose we roll two fair six sided dice. Let1 denote the sum of the numbers
rolled, and let 2 denote the maximum of the numbers rolled.
(a) (i) Create an 11 × 6 matrix containing the values taken by the joint prob-
ability mass function of 1 and 2. The entry in row , column of this
matrix should contain the probability P(1 = , 2 = ).
(ii) Create a three-dimensional bar graph displaying the joint probability
mass function of 1 and 2.
(b) (i) Create a 1× 6 vector containing the values taken by the marginal prob-
ability mass function of 2. The entry in column of this vector should
contain the probability P(2 = ).
(ii) Create a two-dimensional bar graph displaying themarginal probability
mass function of 2.
(c) (i) Create an 11 × 6 matrix containing the values taken by the conditional
probabilitymass function of1 given2. The entry in row , column of
this matrix should contain the conditional probability P(1 = |2 = ).
(ii) Create six two-dimensional bar graphs, each displaying the conditional
probability mass function of 1 given 2 = , with taking the values
1 through 6 in your six graphs.
2
(d) In each of 10,000 iterations of a “for loop”, do the following.
(i) Generate a discrete random variable whose probability mass function
is the marginal probability mass function of 2 calculated in part (b).
Hint: theMATLAB commandrandi(6,2,1) returns a 2×1 random
vector whose entries are independent random variables each equal to
the numbers 1 through 6 with equal probabilities.
(ii) Calculate the conditional expectation E(1 | 2 = ), where is the
random number generated in part (i).
Calculate the average of the conditional expectations computed over all 10,000
iterations of the “for loop”.
(e) Discuss how your findings in part (d) relate to the Law of Iterated Expecta-
tions.
3
Question 2
Let be a random variable with the standard normal distribution, and let() be
the probability density function of the standard normal distribution. Let (1, 2)
be the function
(1, 2) =
{
4(12)?4(?31 + ?32 ? 1)?7/3 if 0 < 1 < 1 and 0 < 2 < 1
0 otherwise.
Suppose that 1 and 2 are a pair of continuous random variables whose joint
probability density function is given by
(1, 2) = (P( ≤ 1), P( ≤ 2))(1)(2)
for all real 1 and 2.
(a) Create a graph of the joint probability density function of1 and2 for values
of 1 and 2 between ?3 and 3.
(b) Create a graph of the marginal probability density function of 1 for values
of 1 between ?3 and 3. Graph it alongside the standard normal probability
density function.
(c) Repeat part (b) for 2 instead of 1.
(d) Based on your answers above, do you think that the joint distribution of 1
and 2 is multivariate normal? Why or why not?
WX:codehelp

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
美凌格栋栋酱 美凌格栋栋酱
6个月前
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
Easter79 Easter79
3年前
typeScript数据类型
//布尔类型letisDone:booleanfalse;//数字类型所有数字都是浮点数numberletdecLiteral:number6;lethexLiteral:number0xf00d;letbinaryLiteral:number0b101
Wesley13 Wesley13
3年前
VBox 启动虚拟机失败
在Vbox(5.0.8版本)启动Ubuntu的虚拟机时,遇到错误信息:NtCreateFile(\\Device\\VBoxDrvStub)failed:0xc000000034STATUS\_OBJECT\_NAME\_NOT\_FOUND(0retries) (rc101)Makesurethekern
Wesley13 Wesley13
3年前
FLV文件格式
1.        FLV文件对齐方式FLV文件以大端对齐方式存放多字节整型。如存放数字无符号16位的数字300(0x012C),那么在FLV文件中存放的顺序是:|0x01|0x2C|。如果是无符号32位数字300(0x0000012C),那么在FLV文件中的存放顺序是:|0x00|0x00|0x00|0x01|0x2C。2.  
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
PHP创建多级树型结构
<!lang:php<?php$areaarray(array('id'1,'pid'0,'name''中国'),array('id'5,'pid'0,'name''美国'),array('id'2,'pid'1,'name''吉林'),array('id'4,'pid'2,'n
Wesley13 Wesley13
3年前
Java日期时间API系列36
  十二时辰,古代劳动人民把一昼夜划分成十二个时段,每一个时段叫一个时辰。二十四小时和十二时辰对照表:时辰时间24时制子时深夜11:00凌晨01:0023:0001:00丑时上午01:00上午03:0001:0003:00寅时上午03:00上午0
Wesley13 Wesley13
3年前
MBR笔记
<bochs:100000000000e\WGUI\Simclientsize(0,0)!stretchedsize(640,480)!<bochs:2b0x7c00<bochs:3c00000003740i\BIOS\$Revision:1.166$$Date:2006/08/1117
Python进阶者 Python进阶者
1年前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这