lecture20

57 %
43 %
Information about lecture20
Entertainment

Published on December 28, 2007

Author: FunnyGuy

Source: authorstream.com

Section 13.2 Handle Graphics:  Section 13.2 Handle Graphics A handle is a “nickname” given to an object in MATLAB We can assign a handle to Individual plots The figure window The axis on which we draw the plots Slide2:  “Tree” structure Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects MATLAB uses a hierarchical system for organizing plotting information Slide3:  Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The basic plotting object is the figure. The figure can contain a number of different objects Slide4:  Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The basic plotting object is the figure. The figure can contain a number of different objects Slide5:  Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The axes are contained inside the figure. Think of the axes as being layered on top of the figure window . The axes also can contain a number of different objects . Slide6:  Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects The axes are contained inside the figure. Think of the axes as being layered on top of the figure window . The axes also can contain a number of different objects . Slide7:  Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects A plot is drawn on top of the axes. Anatomy of a graph:  Anatomy of a graph Figure Axes layered on top of the figure Plot drawn on the axes When you use a plot function…:  When you use a plot function… MATLAB automatically creates a figure an appropriate axis draws the graph (plot) on the axis MATLAB uses default values for many of the plot object properties. For example the first line drawn is always blue, unless the user specifically changes it. How to Change Default Actions:  How to Change Default Actions some defaults can be modified with the plot() function >> xVals=linspace(0,pi,100); >> yVals=exp(sin(xVals)); compare >> plot(xVals, yVals); with >> plot(xVals, yVals,’r’); Handles Allow us to Change (nearly) anything about the plot:  Handles Allow us to Change (nearly) anything about the plot font & size of title font & size of labels style of tick-marks figure heading Slide12:  Figure Axes User Interfaces Annotation axes Core Objects Group Objects Plot Objects Each of these has a handle figure handle axes handle plot handle Figure Handles:  Figure Handles We can specify a handle name for the figure window Using the figure handle, we can change the figure title, background color, etc Slide14:  A figure window has a lot of properties Slide15:  If we haven’t specified a handle name, we can ask MATLAB to determine the current figure with the gcf command (get current figure) get(f_handle) and get(gcf) return the same results in this example try these commands:  try these commands gCounts = [10 9 8 7 2] pie(gCounts, {'A' 'B' 'C' 'D' 'F'}) get(gcf) set(gcf,'Color','red') set(gcf,'Color', [1 0 1]) add a name to your figure set(gcf,’name’,…) generate a plot to work with using the plot() command:  generate a plot to work with using the plot() command xVals=linspace(0,pi,100); yVals=exp(sin(xVals)); plot(xVals, yVals); look at the parent & children of the figure get(gcf) get(gcf,'children') Axis Handles:  Axis Handles Just as we can assign a handle to the figure window and the plot itself, we can assign a handle to the axis using the gca function (get current axis ) for example h_axis = gca Slide19:  h_axis is the name of the axis upon which the plot is drawn in this example Annotation Axes:  Annotation Axes In addition there is a transparent layer added to the plot, used for annotation objects, such as: lines legends text boxes Plot Handles:  Plot Handles Assigning a plot a name (or a handle) allows us to easily ask MATLAB to list the plot object properties Slide22:  h is the plot handle Slide23:  The get function returns a list of the object (in this case a plot) properties summary:  summary get() -- obtain information about a handle-graphics object set() -- change something about a handle-graphics object parent and children show the tree-structure of objects Exercise:  Exercise plot sin(x) for x= 0 to 3 pi Use bold fonts for the title and axis Increase the size of the font for the title by 2 points Slide27:  handle graphics Modify fonts for titles & labels set() discovers all the options for setting things about the axis get(handle) obtains the current settings gca is the handle of the current axes gcf is the handle of the current figure tree structure (gca is a child of gcf, the plot is a child of gca). Slide28:  Preditor-Prey Population Modeling Competition/cooperation between a preditor and prey Lotka-Volterra model Matrix Model Implementation Slide29:  Variables Slide30:  Lotka-Volterra Equation Slide31:  Approximate the solution to the LV model using Matlab Slide32:  Include a phase diagram Slide33:  Hint Instead of letting ode45() generate the plot, capture the solution and plot it yourself [Tvec critterVec] = ode45(@lvRHS, tVals, critters0); Cvec = critterVec(:,1); Pvec = critterVec(:,2); plot(Cvec,Pvec) Slide34:  Connection with handle graphices Change the line thickness of the graphs generated automatically by ode45 Use bold (and larger) fonts for the title. Use bold fonts for the legends and labels.

Add a comment

Related presentations

Related pages

Vorlesung Organische Chemie I - The Richert Research Group

Lecture20_11_09 Author: richert Created Date: 11/20/2009 11:01:24 AM ...
Read more

Lecture #20 - University of California, Berkeley

1 EECS40, Fall 2003 Prof. KingLecture 20, Slide 1 Lecture #20 OUTLINE • The pn junction (cont’d) – reverse breakdown • Load line analysis method
Read more

Lecture20 - Lamont-Doherty Earth Observatory | Lamont ...

Lecture20 2 Preliminaries: A useful identity for proving general properties of Eigenvalues and eigenvectors of Real Symmetric Matrices given A in R
Read more

Lecture20 - SCIENCE - GEM2900

View Notes - Lecture20 from SCIENCE GEM2900 at National University of Singapore. GEM2900 Semester 1, 2009/1010 GEM 2900 Understanding Uncertainty
Read more

Lecture 20 - University of California, Berkeley

4/17/2008 EE105 Fall 2007 1 Lecture 20 OUTLINE • Review of MOSFET Amplifiers • MOSFET Cascode Stage • MOSFET Current Mirror • Reading: Chapter 9
Read more

Lecture 20 - MIT - Massachusetts Institute of Technology

6.012 Spring 2007 1 Lecture 20 Transistor Amplifiers (II) Other Amplifier Stages Outline • Common-drain amplifier • Common-gate amplifier Reading ...
Read more

Lecture 20: PGP, IPSec, SSL/TLS, and Tor Protocols Lecture ...

Lecture 20: PGP, IPSec, SSL/TLS, and Tor Protocols Lecture Notes on “Computer and Network Security” by Avi Kak (kak@purdue.edu) March 29, 2016
Read more

Lecture 20 - Harvard University Department of Physics

What We Did Last Time Hamilton’s Principle in the Hamiltonian formalism Derivation was simple Additional end-point constraints Not strictly needed, but ...
Read more