quiz10 -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Writeanduploadthefunctiondescribedbelowtotheclasswebsite.Inordertoreceivefull credit,yourfunctionmusthaveproperformatting,run,andgivethecorrectoutput. In1828,EnglishbotanistRobertBrownwasobservingmicroscopicparticlesofpollensuspendedin stillwater.Heobservedeventinierparticlesmixedinwiththepollenmovinginanincessant, irregularmotion.Thereasonfortherandommovementofmicroscopicparticlessuspendedinthe liquidwasunknownfordecades. In1905,atomsandmoleculeswerestillopentoobjection.Inthesameyear,AlbertEinstein quantitativelyexplainedthatrandomBrownianmotionwasduetomoleculesinaliquidimpacting largersuspendedparticles.Einstein'sexplanationofBrownianmotionwasimportantinhelpinggain acceptanceoftheatomictheoryofmatter. WriteaMATLABfunctiontosimulateBrownianmotionofaparticlesuspendedinafluid.Your particleshouldstartattheorigininthexyplane.Furthermore,assumeeachdisplacement(step)of theparticlefromitspreviouspositionhasamagnitudeof1unitoflengthandarandomdirection. Theinputtoyourfunctionshouldbethenumberofstepsinthesimulation.Theoutputofyour functionshouldbeaplotofthetrajectoryoftheparticleinthexyplane.Forfun,runyoursimulation functionfor10,100,1000,and10,000steps. Hints:Userandtogeneratearandomnumber between0and1foreachstep.Usethe generatedrandomnumbertodeterminea randomdirection(02)foreachstep. Convertyourstepfrompolarcoordinatesto Cartesiancoordinates.Useaforloopto generatetheNstepsofyoursimulation,and writethe(x,y)positionoftheparticleaftereach steptoaNx2matrix.Thefirstcolumnofthe matrixshouldgivethexvaluesoftheparticle aftereachstepandsecondcolumnofthematrix shouldgivethecorrespondingyvaluesofthe particleafterthestep.Finally,youmayfinda termlikex(end,:)isimportantingenerating theNx2matrix.Whenusingendinthecontext ofanarrayindex,itspecificsthelastindexin MATLABsimulationofBrownianmotion.The thearray. particlestartedat(x,y)=(0,0)and10,000steps laterendedat(x,y)=(53.12,95.07) Forexample,ifx=[00;11;22;33], thenx(end,:)=[33].Inotherwords,byusingendinthiswayweareabletogetvaluesforthelast rowofmatrixx.Theaboveplotgivestheresultofyourinstructor'sBrownianmotionsimulation functionfor10,000steps. IntroductiontoComputationalPhysics Phy265Quiz10(TakeHome) Due12:40p.m.April22,2011 ...
View Full Document

Ask a homework question - tutors are online