This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Session 8: Plotting Graphs [June 5, 2011, 12:53 p.m.]


Objectives

In this session you will learn the following:

  1. Plotting 2 dimensional line graphs
  2. Annotating graphs with grids, axis labels, graph titles
  3. Exporting graphs for inclusion in documents
  4. Plotting 3 dimensional surface graphs
  5. Plotting multiple graphs on one page (subplot())

Functions for Plotting

In this session, we will learn the following functions:

plot(), plot2d(), xgrid(), xtitle(), legend(), plot3d(), linspace()

Plotting Basics

Scilab is a data plotter, that is, it plots graphs from the data you input. This is in contrast to function plotting programs (such as gnuplot) which plot graphs of functions without the user having to first explicitly generate the data required to plot the graph. Function plotting programs will decide the range of the values of independent variable and its data interval, generate the data on the fly and plot the graph.

The data to be used to plot the graph(s) can be arranged in one of the following ways:

  1. Values of independent and dependent variables in two columns (or two rows) of the same variable.
  2. Values of independent and dependent variables in two different variables. Each may either be a row or a column vector. They must have the same size.
  3. Independent variable in