Академический Документы
Профессиональный Документы
Культура Документы
BY S. M. Kulkarni
06/09/2013 1
Outline
Animation
What? Why?
animation in matlab
comet handle graphics examples
06/09/2013 2
Animation
What is animation?
process of creating continuous motion and shape change illusion
06/09/2013
Animation
Why animation is used?
Data representation of dynamics of system Good visual impact
Time (sec) 0 0.1 0.2 0.3 0.4 0.5 Distance Traveled (m) 0 0.001 0.002 0.003 0.004 0.005
0.6
0.7 0.8 0.9 1 06/09/2013
0.006
0.007 0.008 0.009 0.01 4
Animation in matlab
2 Facilities
1) Comet Similar to plot command, Can animate 2D or 3D plots,
Comet head moves along the curve and tail traces the line connecting data points,
Graph Being Plotted
Image courtesy: Wikipedia
06/09/2013 5
Animation in matlab
1) Comet
Command Syntax (for 2D curves) >> comet (x, y)
where x and y are the predefined vectors to be plotted
e.g.
Animating a line y = 0.5 * x + 5, in the range of 0 < x < 10 1) Define vector of x and y, 2) Use comet (x, y) figure window will open and you will see a curve being plotted. Practice Examples Straight line, Circle, Triangle, Ellipse.etc.
06/09/2013 6
Animation in matlab
1) Comet
Command Syntax (for 3D curves) >> comet (x, y, z)
where x, y and z are the predefined vectors to be plotted e.g. Animate 3D inwardly spiraling helix by using following co ordinates X = exp(-0.02*t).*sin(t), Y = exp(-0.02*t).*cos(t), Z = t. 1) Define vector for t, range of t is [0, 10*pi] 2) Define vectors for X, Y. Limitations: Simple but can animate curves only.
06/09/2013 7
Animation in matlab
2) Handle Graphics
i) What is Handle?
floating point number (FPN) assigned by MATLAB for every entity in figure window which can be used as an address for that entity
Animation in matlab
2) Handle Graphics
Commands Related to handle
get (hl) lists all properties related to handle hl and its values
06/09/2013
Animation in matlab
2) Handle Graphics
A bead rotating around the circumference of circle
clf; % Clears any previous figure
% Draws the bead at initial position % and assigns handle to it % Sets the limits of the axes % Sets the format of axes to Square
Animation in matlab
2) Handle Graphics
A program for Slider Crank Mechanism 1) Develop the mathematical expressions for various points on it 2) Develop program for it.
06/09/2013
11
Any questions ? ? ?
06/09/2013
12
Thank You
06/09/2013
13