To days outline
1 / 22

To days Outline - PowerPoint PPT Presentation

  • Uploaded on

To days Outline. Linear Equations ODE Integration Handle Graphics. Exercises on this days topics. Linear Equations. Linear equations Using left division MATLAB uses Gaussian elemination Has the solution in MATLAB X=A\Y Example: Solve the system of linear equation:. ODE.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'To days Outline' - leanna

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
To days outline
To days Outline

  • Linear Equations

  • ODE

  • Integration

  • Handle Graphics.

  • Exercises on this days topics

Lecture 5

Linear equations
Linear Equations

  • Linear equations

    • Using left division

    • MATLAB uses Gaussian elemination

  • Has the solution in MATLAB

    • X=A\Y

  • Example:

    Solve the system of linear equation:

Lecture 5

To days outline

  • MATLAB can solve system of first order ordinary differential equations with known initial condition.

  • MATLAB offers a number of different solvers

    • ode45

      • This is the typical first solver to try on a new problem.

    • ode15s

      • This is typical to try if ode45 fails or are too inefficient. Solves stiff problems.

      • Stiff problem are described as problem in which the time constants vary a lot.

Lecture 5

To days outline

  • General form

    • [time,x]=solver(fh,t,x0)

      • time: Time values

      • x: contains the solution for each time value

      • solver: one of MATLAB’s ode solvers

      • fh: A function handle to the function that describes the differential equations

      • t: is the time span T0 to TFINAL

      • x0: Initial condition

Lecture 5

To days outline


Solve the differential equation:

Lecture 5

To days outline

Lecture 5

To days outline

  • Higher order differential equations must be rewritten into system of first order differential equations.






Lecture 5


  • Trapezoidal numerical integration.

    • z = trapz(x,y)

      • computes the integral of y with respect to x using the trapezoidal method.

  • The trapezoidal technique is used when we only know the integrand in a number of specific points.

  • With a smaller delta-x the numerical integration becomes more accurate

Lecture 5

Handle graphics
Handle Graphics

  • A set of low level functions that control the characteristic of a graphic object.

  • Changing grids, line color etc. that is not supported by the standard LinSpec option in the plot command.

  • MATLAB graphics system is based on a hierarchical system of Graphical Objects

Lecture 5

Handle graphics1
Handle Graphics

  • Each graphical object are known by a unique name: Handle

  • Each graphical object has special data: properties

  • A handle is automatically returned by any command that creates a graphic object.

    • Hndl=figure

Lecture 5

Handle graphics2
Handle Graphics

Lecture 5

Handle graphics3
Handle Graphics

  • When an object is created all of its properties are initialized to default values.

    • plot(y) uses the default line color, line style, line width etc.

  • All properties can be examined using:

    • get(Handle,’PropertyName’) ;

  • All properties can be changed using:

    • set(Handle,’PropertyName’,Value1’,….);

    • If value are left out MATLAB display a list of possible property values for that actual property name

Lecture 5

Handle graphics4
Handle Graphics

  • To view all properties:

    • x=[0:0.1:2];

    • y=x.^2;

    • Hndl=plot(x,y) %Handle to the line.

    • result=get(Hndl)

      • result will be a structure containing all properties to the line

Lecture 5

Handle graphics5
Handle Graphics

Lecture 5

Handle graphics6
Handle Graphics

  • To change the line width from default 0.5 to 5:

    • set(Hndl,’LineWidth’,5)

Lecture 5

Handle graphics7
Handle Graphics

  • Functions that return handles

    • gcf

      • Get current figure.

    • gca

      • Get current axes in the current figure.

    • gco

      • Get current object in the current figure.

    • findobj

      • Finds a graphics object with a specific property value

  • The current object is defined as the last object clicked on with the mouse.

Lecture 5

Handle graphics8
Handle Graphics

  • Position of figure Objects

    • [left bottom width height]

  • Units can be: pixels, inches, cm, points and normalized coordinates.

  • Normalized coordinates are between 0-1.

    • (0,0) = Lower left corner

    • (1,1) = Upper right corner

  • Using normalized coordinates will make the figure to appear in the same relative position regardless of screen resolution.

    • Normalized coordinates are recommended to use if possible

  • Lecture 5

    Handle graphics9
    Handle Graphics

    • Position of axes and uicontrol Objects

    • Also a 4-element vector.

      • [left bottom width height]

    • Position is specified relative to the figure that contains the object.

    • Default units:

      • Normalized coordinates within the figure.

    Lecture 5

    Handle graphics10
    Handle Graphics

    • Position of text Objects

    • The position of a text object refers to the actual axes.

      • x,y in 2D

      • x,y,z in 3D

    • The position of the text object relative to a specified point is controlled by:

      • HorizontalAlignment

        • {Left},Center,Right

      • VerticalAlignment

        • {Middle}, Top, Cap, Baseline, Bottom

    Lecture 5

    Handle graphics11
    Handle Graphics


    - Construct a dartboard with 10 circles.

    - Add text in each circle what the point would be if the dart should hit within that circle.

    - Construct a frame around the dartboard.

    - Simulate that a person throw 10 darts at the

    board with the standard deviation 4 in x and y direction.

    Lecture 5