College of Engineering Logo Web Server Logs Student Server Logs Orange bar Main Page General Information Special Events Programs Research Student Information Computer Facility Outreach Xtreme Engineering Jobs Available

Plotting two-dimensional functions

Computer Facility University of Hawaii at Manoa
College of Engineering

Please read the section on defining your own functions if you intend to define your own functions.

The syntax of the plot command for a two-dimensional function is as follows:

plot {ranges} function {title "title text"} {style}
If several plots are to be plotted, subsequent functions (or data plots) can be specified, separated by commas. The optional sections are shown with braces. Note that only one set of ranges can be specified, as the subsequent plots (or data plots) use the same range. By omitting those optional sections, the simplest plot only needs the function to be plotted, as shown:
plot sin(x)

Fine Tuning your Plots

When gnuplot creates a function plot, it samples 100 points of the function in the specified range. You can adjust the number of points taken with the set samples command. Note that plotting will take somewhat longer if more points are specified. (You can also set it to something less than 100 points, as well.) Here is an example of two plots of the sinc function, with different sampling rates:
sinc(x) = sin(pi * x) / (pi * x)
set samples 25; plot sinc(x)
set samples 500; plot sinc(x)
Many other options are available to let you change the plot's output.

Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)

Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu


Last updated on Thursday, August %.1d, 2002
Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.