Presentation is loading. Please wait.

Presentation is loading. Please wait.

PH36010 Numerical Methods Advanced Plotting and Animation.

Similar presentations


Presentation on theme: "PH36010 Numerical Methods Advanced Plotting and Animation."— Presentation transcript:

1 PH36010 Numerical Methods Advanced Plotting and Animation

2 Advanced Plotting in MathCAD Polar PlotsPolar Plots 3D Plots3D Plots –Surface –Contour –Scatter –Bar Vector Field PlotsVector Field Plots

3 Polar Plots #1 X-Y Plot wrapped around a circleX-Y Plot wrapped around a circle r=cos 2 (  )

4 Polar Plots #2 r=e k r=e k 

5 Uses for Polar Plots Rotating MachinesRotating Machines –Stirling engine –Vibration Arctic & Antarctic systemsArctic & Antarctic systems

6 3D surface plots Simple #1 Plot of data stored in arrayPlot of data stored in array Indices of array represent x-y planeIndices of array represent x-y plane Value of matrix is z valueValue of matrix is z value –Define size of matrix & indices –Determine values for x & y –Fill matrix –Plot

7 3D surface plots Simple #2 Define size & indicesDefine size & indices Define Range for x & yDefine Range for x & y 2D-Gaussian2D-Gaussian Fill matrixFill matrix

8 3D surface plots Simple #3

9 3D surface plots Simple #4 – Lighting

10 Contour Plot - from 3d plot data Format plot type -> Contour plotFormat plot type -> Contour plot

11 Simple 3D plots Limitations X & Y axes scaled in indicesX & Y axes scaled in indices Suited to continuous single valued functionsSuited to continuous single valued functions More advanced 3D plots availableMore advanced 3D plots available

12 3D Scatter plot Plot of individual pointsPlot of individual points Supply with 3 vectors of equal length (X,Y,Z)Supply with 3 vectors of equal length (X,Y,Z) Points plotted:Points plotted: –X 0,Y 0,Z 0 –X 1,Y 1,Z 1 –…–…–…–…

13 3D scatter plot Photon Scatter in 3D

14 3D surface plots Parametric Plot Plot complex surfacesPlot complex surfaces From Resource Centre Guide to 3D plottingFrom Resource Centre Guide to 3D plotting

15 3D parametric plot Example -  100 2 for H X- & Y- Axes scaled in m

16 Parametric Plots How to… #1 Rubber sheet N x MRubber sheet N x M Wrap sheet around surfaceWrap sheet around surface XX a,b is x-coord of point a,bXX a,b is x-coord of point a,b YY a,b is y-coord of point a,bYY a,b is y-coord of point a,b ZZ a,b is z-coord of point a,bZZ a,b is z-coord of point a,b (XX,YY,ZZ) will plot surface(XX,YY,ZZ) will plot surface

17 Parametric Plots Example 1 - Gaussian Ranges defined as beforeRanges defined as before Fill XX & YY matricesFill XX & YY matrices Fill ZZ matrixFill ZZ matrix

18 Parametric Plots Example 1 - Gaussian Note:Note: –Axes scaled

19 A short diversion Simple Program #1 Often need to create a vector containing a range of valuesOften need to create a vector containing a range of values Create function to do this using MathCAD program stepsCreate function to do this using MathCAD program steps Use in graphics programsUse in graphics programs

20 The SeriesVector() program  (increment) and i (loop count) are ‘local’ to function. Function builds Result vector Returned on last line of program

21 Testing the SeriesVector() function

22 Parametric Plots Polar 3D #1 Create r vector 0-10 radii, 100 tepsCreate r vector 0-10 radii, 100 teps Create  vector -180..180 deg, 30 stepsCreate  vector -180..180 deg, 30 steps Fill X & Y vectorsFill X & Y vectors

23 Paramteric Plots Polar 3D #2 Define  100 function Fill Z matrix with  100 function  100 function NB Only depends on r

24 3D parametric plot Example -  100 2 for H X- & Y- Axes scaled in m

25 Plot of  210 2 for H X & Y matrices as beforeX & Y matrices as before Z now depends on r,qZ now depends on r,q

26 3D parametric plot Example -  210 2 for H

27 Vector Field Plots #1 Arrows give strength & direction of field at each point of plot.Arrows give strength & direction of field at each point of plot. Constructed from either:Constructed from either: –Matrix of complex numbers –2 identical matrices of real numbers

28 Vector Field Plots #2 From Resource Centre Example function to plotExample function to plot Gradient function of f(x,y)Gradient function of f(x,y)

29 Vector Field Plot Surface Plot Vector Field Plot

30 Pretty Pictures #1 From Resource Centre Chain of Tori Pyramid

31 Pretty Pictures From Resource Centre Plot multiple Surfaces

32 Pretty Pictures #3 Planetary Orbit 3 objects3 objects –Planet : (xe,ye,ze) –Star : (xs,ys,zs) –Orbit: (xp,yp,zp)

33 Animation Principles Make output depend on FRAMEMake output depend on FRAME Tools|Animation|Record… to display dialogTools|Animation|Record… to display dialog –Fill in first & last frames –Drag cursor around area to animate –Select ‘Animate’ to go –View with AVI player –Save to disk Help|Quicksheets|Graphing and VisualizationHelp|Quicksheets|Graphing and Visualization

34 Animation Hints and Tips Fix scale of graphsFix scale of graphs Watch out for:Watch out for: –Size of AVI files –Long calculation times Can test by using FRAME:=Can test by using FRAME:= –Delete afterwards Put indicator in moviePut indicator in movie

35 Animation Example #1 Cannon Ball with drag

36 Animation Example #2 LCR at resonance

37 Animation Example #3 Heat Flow in Plate

38 Animation Example #4 Planetary Orbits

39 3D with lighting & shadows

40 Ideas for projects Bouncing ballsBouncing balls –Gravity –Snooker Electron clouds around HElectron clouds around H Simulation of Ion ImplantationSimulation of Ion Implantation Heat flow by finite differenceHeat flow by finite difference


Download ppt "PH36010 Numerical Methods Advanced Plotting and Animation."

Similar presentations


Ads by Google