330 likes | 587 Views
PH36010 Numerical Methods. Advanced Plotting and Animation. Advanced Plotting in MathCAD. Polar Plots 3D Plots Surface Contour Scatter Bar Vector Field Plots. Polar Plots #1. X-Y Plot wrapped around a circle. r=cos 2 ( q ). Polar Plots #2. r=e k q. Uses for Polar Plots.
E N D
PH36010 Numerical Methods Advanced Plotting and Animation
Advanced Plotting in MathCAD • Polar Plots • 3D Plots • Surface • Contour • Scatter • Bar • Vector Field Plots
Polar Plots #1 • X-Y Plot wrapped around a circle r=cos2(q)
Polar Plots #2 • r=ekq
Uses for Polar Plots • Rotating Machines • Stirling engine • Vibration • Arctic & Antarctic systems
3D surface plotsSimple #1 • Plot of data stored in array • Indices of array represent x-y plane • Value of matrix is z value • Define size of matrix & indices • Determine values for x & y • Fill matrix • Plot
3D surface plotsSimple #2 • Define size & indices • Define Range for x & y • 2D-Gaussian • Fill matrix
Contour Plot- from 3d plot data • Format plot type -> Contour plot
Simple 3D plotsLimitations • X & Y axes scaled in indices • Suited to continuous single valued functions • More advanced 3D plots available
3D Scatter plot • Plot of individual points • Supply with 3 vectors of equal length (X,Y,Z) • Points plotted: • X0,Y0,Z0 • X1,Y1,Z1 • …
3D surface plotsParametric Plot • Plot complex surfaces • From Resource Centre Guide to 3D plotting
3D parametric plotExample - 1002 for H X- & Y-Axes scaled in m
Parametric PlotsHow to… #1 • Rubber sheet N x M • Wrap sheet around surface • XXa,b is x-coord of point a,b • YYa,b is y-coord of point a,b • ZZa,b is z-coord of point a,b • (XX,YY,ZZ) will plot surface
Parametric PlotsExample 1 - Gaussian • Ranges defined as before • Fill XX & YY matrices • Fill ZZ matrix
Parametric PlotsExample 1 - Gaussian • Note: • Axes scaled
The SeriesVector()program D (increment) and i (loop count) are ‘local’ to function. Function builds Result vector Returned on last line of program
Parametric PlotsPolar 3D #1 • Create r vector0-10 radii, 100 teps • Create q vector-180..180 deg, 30 steps • Fill X & Y vectors
Paramteric PlotsPolar 3D #2 Define 100 function Fill Z matrix with 100 function NB Only depends on r
3D parametric plotExample - 1002 for H X- & Y-Axes scaled in m
Plot of 2102 for H • X & Y matrices as before • Z now depends on r,q
Pretty Pictures From Resource Centre Plot multiple Surfaces
Pretty Pictures #3 Planetary Orbit • 3 objects • Planet : (xe,ye,ze) • Star : (xs,ys,zs) • Orbit: (xp,yp,zp)
Animation Principles • Make output depend on FRAME • Tools|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 Visualization
AnimationHints and Tips • Fix scale of graphs • Watch out for: • Size of AVI files • Long calculation times • Can test by usingFRAME:= • Delete afterwards • Put indicator in movie