Top Banner
Chapter 10: Graphics MATLAB for Scientist and Engineers Using Symbolic Toolbox
40

Chapter 10: Graphics

Feb 14, 2016

Download

Documents

Kyle

Chapter 10: Graphics. MATLAB for Scientist and Engineers Using Symbolic Toolbox. You are going to. Review the basics of plotting simple 2-D/3-D graphs and animations Create graphs with different attributes Generate advanced animated graphs with timing control - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 10: Graphics

Chapter 10:Graphics

MATLAB for Scientist and Engineers

Using Symbolic Toolbox

Page 2: Chapter 10: Graphics

2

You are going to Review the basics of plotting simple 2-D/3-D

graphs and animations Create graphs with different attributes Generate advanced animated graphs with

timing control Handle cameras for static and animated 3-D

graphs

Page 3: Chapter 10: Graphics

3

Introduction Graphics – Tool for exploring math objects MuPAD: Easy 2-D, 3-D and animated graphs Interactive graph attributes editor Plot library does it all

Page 4: Chapter 10: Graphics

4

2-D Simple Function Graphs Simple function graph with range

Page 5: Chapter 10: Graphics

5

2-D Multiple Function Graphs Multiple plots wo/wt legend

Page 6: Chapter 10: Graphics

6

2-D Graphs – Matrix Eigenvalues Max. Eigenvalues of a Matrix

Page 7: Chapter 10: Graphics

7

2-D Piecewise Graphs Piecewise functions

Page 8: Chapter 10: Graphics

8

2-D Function Graphs with Y Range Y range control

Page 9: Chapter 10: Graphics

9

2-D Simple Animations Additional animation parameter

Page 10: Chapter 10: Graphics

10

2-D Multiple Function Animations Additional animation parameter

Default No. of Frames = 50

Page 11: Chapter 10: Graphics

11

Attributes of 2D Graphs Mesh Control

121 2

Page 12: Chapter 10: Graphics

12

Attributes Control Details Grid, Ticks and Header

Page 13: Chapter 10: Graphics

13

Specifying Viewing Box Y Range of Viewing Box

Page 14: Chapter 10: Graphics

14

Specifying Viewing Box (cont.) Semi-automatic control of Y Range

Page 15: Chapter 10: Graphics

15

3-D Function Graphs

Page 16: Chapter 10: Graphics

16

3-D Function Graphs (cont.) Generated 3-D Graphs

Page 17: Chapter 10: Graphics

17

Submesh for Smoother Surface Submesh

Without Submesh With Submesh

Page 18: Chapter 10: Graphics

18

3-D Animations

Default No. of Frames = 50

Animation Parameter

Flying Carpet

Page 19: Chapter 10: Graphics

19

Advanced 2-D Graphs Several objects with different attributes in a

single graph

Plot primitives

Page 20: Chapter 10: Graphics

20

Anatomy of Complex 2D Graph Function and its tangential line at a point

plot::Point2dplot::Line2d

plot::Function2d

Page 21: Chapter 10: Graphics

21

Advanced 2-D Animation Line and point are animated.

Page 22: Chapter 10: Graphics

22

Moving Tangential Line Function and its tangential line at a moving

point

Page 23: Chapter 10: Graphics

23

Example: Interpolated Curve Original curve and its sampled points

Interpolated points using cubic spline

Both curves and sampled points

Page 24: Chapter 10: Graphics

24

Compare the Curves Original curve, sampled points and interpo-

lated curve

Page 25: Chapter 10: Graphics

25

Example: Cycloids A cycloid is the curve that you get when following a point

fixed to a wheel rolling along a straight line. We visualize this construction by an animation in which we use the x coordinate of the hub as the animation parameter. The wheel is realized as a circle. There are 3 points fixed to the wheel: a green point on the rim, a blue point inside the wheel and a red point outside the wheel:

source code can be found in 'ch10_graphics_demo.mn'

Page 26: Chapter 10: Graphics

26

Example: ODE Vector Field We wish to visualize the solution of the ordinary differential equation

(ODE) y′(x) = −y(x)3 + cos(x) with the initial condition y(0) = 0. The so-lution shall be drawn together with the vector field v⃗ (x, y) = (1,−y3 + cos(x)) associated with this ODE (along the solution curve, the vec-tors of this field are tangents of the curve).

source code can be found in 'ch10_graphics_demo.mn'

Page 27: Chapter 10: Graphics

27

Example: Surface by Rotated Curve Create an interpolated curve from a series of

data points. Rotate the curve to get the corresponding

surface.

source code can be found in 'ch10_graphics_demo.mn'

Page 28: Chapter 10: Graphics

28

RGB Colors

Opacity

Page 29: Chapter 10: Graphics

29

Simple Animation

Page 30: Chapter 10: Graphics

30

Animation: Arc

Page 31: Chapter 10: Graphics

31

Animation Parameters Animation parameters are for each objects.

Page 32: Chapter 10: Graphics

32

Animation Parameter - Global Animation parameter serves as a global var.

Page 33: Chapter 10: Graphics

33

Time Synchronization

Page 34: Chapter 10: Graphics

34

Integration and Area

source code can be found in 'ch10_graphics_demo.mn'

Page 35: Chapter 10: Graphics

35

Transformations Translate, rotate and scale a group of graph

objects.

Page 36: Chapter 10: Graphics

36

Animated Rotation

Page 37: Chapter 10: Graphics

37

Using Camera

Page 38: Chapter 10: Graphics

38

Animated Camera Camera trajectory

Lorenz attractor

source code can be found in 'ch10_graphics_demo.mn'

Page 39: Chapter 10: Graphics

39

Key Takeaways Now, you are able to

plot 2-D and 3-D graphs using different objects and attributes,

generate 2-D and 3-D animations with different objects and attributes,

and to control colors and cameras for your graphs.

Page 40: Chapter 10: Graphics

40

Notes