如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
.........MATLABWorkbookENGR155CMathematicalandComputationalMethodsforEngineersFirstEditionVadimKhaymsTableofContentsTOC\o"1-3"\n\h\zHYPERLINK\l"_Toc498446528"1.RandomNumberGenerationHYPERLINK\l"_Toc498446529"2.ProbabilityDistributionsHYPERLINK\l"_Toc498446530"3.ParameterEstimationHYPERLINK\l"_Toc498446531"4.HypothesisTesting(singlepopulation)HYPERLINK\l"_Toc498446532"5.HypothesisTesting(twopopulations)HYPERLINK\l"_Toc498446533"6.RegressionandCorrelationAnalysesProbability&Statistics1.RandomNumberGenerationCommands:unidrndGeneratesadiscreterandomnumberorarandomvectorunifrndGeneratesarandomnumberoravectorfromauniformdistributionhistCreatesafrequencyplot(histogram)WewillattempttosolveoneofthehomeworkproblemsnumericallybyperformingavirtualexperimentusingMATLAB’srandomnumbergenerator.Theproblemisasfollows.Twopointsaandbareselectedatrandomalongthex-axissuchthatand.Findtheprobabilitythatthedistancebetweenaandbisgreaterthan3byperformingonemilliontrials.Makeahistogramofthegenerateddistancesbetweenxandy.SOLUTIONTwovectorsofrandomnumberseachwithonemillionelementswillbedrawnfromauniformdistributionandthedistancebetweenthecorrespondingelementscomparedto3.Seecodebelow.clear;x=unifrnd(-2,0,1,1000000);y=unifrnd(0,3,1,1000000);s=0;d=abs(x-y);fori=1:1000000ifd(i)>3s=s+1;elseendendhist(d,100)Probability=s/1000000Runningthecode:Probability=0.3345%Theexactanalyticalsolutionis1/3Hint:generatingavectorofrandomnumbersallatonceiscomputationallymoreefficientthangeneratingrandomvaluesoneatatimewithinaforloop!YOURTURNUsingMATLAB,verifyyouranswertooneotherhomeworkproblem,whichfollows.Apointisselectedatrandominsideacircle.Findtheprobabilitythatthepointisclosertothecenterofthecirclethantoitscircumference.Hint:generatearandomvectorofxandycoordinatesfirst,thenconsideronlythosepoints,whichareinsidethecircle2.ProbabilityDistributionsCommands:binopdfPDFforthebinominaldistribu