正在加载图片...
350 CHAPTER 11.PROGRAMMING IN MATLAB a "cell".)Thus the entire geometry of the pipe,the two chambers and enclosing walls could be represented by a 32 x 32 array in MATLAB.The space within the walls is given the value“o”for vacuum and the walls are given the value“-l”. Now,fill one of the chambers with molecules,placed randomly.In the example in second figure,I placed 100 molecules.Note that I allowed more than 1 molecule per cell.Each cell contains a number that represents the number of molecules within the cell.Since MATLAB's random number generator seeds differently every time,your distributions will look different. 3.5 25 2.5 20 1.5 10 0.5 0.5 10 15 20 25 30 Figure 11.10:The left chamber filled with 100 molecules. Now,a time-step is executed.During this time-step,each individual molecule can move randomly in any direction by one cell,upwards,downwards,sideways,or diagonally. If the new direction would cause the molecule to hit one of the walls,the proposed step is invalid and a new direction should be picked randomly.If a molecule enters the rightmost column of cells,it "sticks"to the cold wall and can no longer be moved. The third figure shows the distribution of molecules after 2000 time-steps. Finally,the simulation ends when all the molecules are trapped in the cold trap.The final configuration of my example is shown in the fourth figure. Here is what you must do to complete this problem.350 CHAPTER 11. PROGRAMMING IN MATLAB a “cell”.) Thus the entire geometry of the pipe, the two chambers andenclosing walls couldbe representedby a 32 × 32 array in MATLAB. The space within the walls is given the value “0” for vacuum andthe walls are given the value “-1”. Now, fill one of the chambers with molecules, placedrandomly. In the example in secondfigure, I placed100 molecules. Note that I allowedmore than 1 molecule per cell. Each cell contains a number that represents the number of molecules within the cell. Since MATLAB’s random number generator seeds differently every time, your distributions will look different. −1 −0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 5 10 15 20 25 30 5 10 15 20 25 30 Figure 11.10: The left chamber filledwith 100 molecules. Now, a time-step is executed. During this time-step, each individual molecule can move randomly in any direction by one cell, upwards, downwards, sideways, or diagonally. If the new direction would cause the molecule to hit one of the walls, the proposed step is invalidanda new direction shouldbe pickedrandomly. If a molecule enters the rightmost column of cells, it “sticks” to the coldwall andcan no longer be moved. The thirdfigure shows the distribution of molecules after 2000 time-steps. Finally, the simulation ends when all the molecules are trapped in the cold trap. The final configuration of my example is shown in the fourth figure. Here is what you must do to complete this problem
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有