E77: INTRODUCTION TO COMPUTER PROGRAMMING FOR SCIENTISTS AND ENGINEERS - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

E77: INTRODUCTION TO COMPUTER PROGRAMMING FOR SCIENTISTS AND ENGINEERS

Description:

Any one-dimensional polynomial of n-th degree can be. expressed as: ... Histograms (hist) Error bars (errorbar) Other special plots (area, fill, scatter) E77 L6 ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 10
Provided by: pack3
Category:

less

Transcript and Presenter's Notes

Title: E77: INTRODUCTION TO COMPUTER PROGRAMMING FOR SCIENTISTS AND ENGINEERS


1
E77 INTRODUCTION TO COMPUTER PROGRAMMING FOR
SCIENTISTS AND ENGINEERS
  • Lecture Outline
  • 1. Polynomials as arrays
  • 2. Two-dimensional plots
  • 3. Three-dimensional plots

2
Polynomials as arrays
  • 1. Polynomials as arrays
  • Any one-dimensional polynomial of n-th degree can
    be
  • expressed as
  • Such a polynomial can be put in one-to-one
  • correspondence with a one-dimensional array
  • Note n-th degree polynomials correspond to
  • n1-dimensional vectors!

3
Polynomials as arrays
  • All basic polynomial operations, such as
    addition, scalar
  • multiplication and division can be rendered
    easily as
  • vector operations. In particular
  • Addition/subtraction is equivalent to
    element-wise addition/subtraction of equal-sized
    vectors.
  • Scalar multiplication is equivalent to
    element-wise multiplication of a vector by a
    scalar.

4
Polynomials as arrays
  • Multiplication and division between polynomials P
    and Q is handled in MATLAB by the functions
    conv(P,Q) and deconv(P,Q).
  • The evaluation of a polynomial P for a given
    argument x is handled in MATLAB by the function
    polyval(P,c)

5
Polynomials as arrays
  • Polynomial root-finding is handled by the
    function roots(P).
  • Polynomial differentiation is handled by the
    function polyder(P).
  • Polynomial integration is handled by the function
    polyint(P,c).

6
Two-dimensional plots
  • 2. Two-dimensional plots
  • The effective visual representation of data is of
    great
  • significance in science and engineering.
  • Two-dimensional plots in MATLAB
  • Simple x-y plots (plot)
  • Pie charts (pie)
  • Bar and stair charts (bar, stairs)
  • Histograms (hist)
  • Error bars (errorbar)
  • Other special plots (area, fill, scatter)

7
Three-dimensional plots
  • 3. Three-dimensional plots
  • Three-dimensional plots in MATLAB
  • Simple x-y-z plots (plot3)
  • Mesh plots (mesh, meshc, meshz)
  • Surface plots (surf, surfc, surf1)
  • Pie charts (pie3)
  • Bar plots (bar3)
  • Contour plots (contour, contour3)
  • The view command controls the perspective of a
  • plot.

8
Three-dimensional plots
  • Remarks on plots
  • The type of data and the scope of their
    presentation dictates the choice of plot option.
  • Always label the axes and put a title on each
    plot.
  • Be sure to scale the axes as necessary (linear or
    logarithmic scales).
  • Avoid extremely busy plots.
  • Use subplots when plotting on the same plot
    becomes too busy.
  • When producing plots always keep the target
    audience in mind.

9
Summary
  • What did we learn today?
  • One dimensional polynomials can be treated
    equivalently as vectors.
  • Basic polynomial operations readily reduce to
    corresponding vector operations.
  • Two- and three-dimensional plots are effective
    visual mean of communicating technical
    information.
  • The choice of plots is dictated by the type of
    data and the scope of the presentation.
  • When generating plots, keep the target audiences
    needs and tastes in mind!
Write a Comment
User Comments (0)
About PowerShow.com