Your company here — click to reach over 10,000 unique daily visitors

# c-graph - Man Page

visualization tool for the convolution theorem

## Synopsis

`c-graph [-d|-h|-v] [-n]`

## Description

GNU C-Graph (for Convolution Graph) is a tool for visualizing the convolution of two signals using Gnuplot under the X Window System. It computes the linear convolution of two signals in the time domain, then compares their circular convolution by demonstrating the convolution theorem - convolution of two signals in the time domain corresponds to multiplication in the frequency domain.  Gnuplot command and graphics output files are saved in the c-graphs directory for later use.

Each signal is modeled by a register of discrete values simulating samples of a signal, and the discrete Fourier transform (DFT) computed by means of the fast Fourier transform (FFT). FFTs are computed on data series containing a power of two elements. c-graph accepts data series sizes of powers of two in the range 64 to 1024, inclusive.

c-graph is menu-driven: it prompts the user for a number of samples, the signal type, frequency, and a scaling coefficient (if applicable).

Data sets may consist of 64, 128, 256, 512, or 1024 samples.  If any other data set size is chosen, the size is adjusted to the nearest allowed power of two.

Signals may be periodic or aperiodic, according to input waveform type.

These signal types are periodic: sine, cosine, triangle, square, and sawtooth. Periodic signals can be selected as continuous waves or as a pulse.  If the pulse form is chosen, the input signal consists of a half-wave of the signal type.  For example, a sine wave chosen as a pulse will provide a sine wave of half the full wave duration (i.e., from 0 to π radians, or 0 to 180°).

These signal types are aperiodic: exponential, ramp, and the step function.

The allowable frequency range is from 0.5 to N/4, where N is the number of samples.  If a value is entered outside of this range, the frequency is set to a default of 1 Hz.

The scaling coefficient may be positive or negative.  The maximum absolute value of the scaling coefficient for signal types sine, cosine, exponential, and the step function is N, whereas for signal types triangle, square, sawtooth and ramp the maximum scale is 1. With the default scaling coefficient of 1, signal types sine, cosine, exponential, and the step function are unit functions; signal types square and sawtooth have a maximum amplitude of half the period, whereas that of a triangle is one-quarter the period.

Whether student, engineer, or scientist, aspiring special-effects animator or roboticist, GNU C-Graph will help you find the adventure in the mathematics of convolution.

## Options

-d,  --dedicate

Print the dedication and exit.

-h,  --help

Print the list of options and exit.

-n,  --no-splash

Invoke GNU C-Graph with no splash screen.

-v,  --version

Print the version of GNU C-Graph and exit.

## Environment Variables

GDFONTPATH

This is the directory path that gnuplot(1) searches for fonts to produce its graphs.  c-graph commands gnuplot to use a font named "serif".  If gnuplot does not find this font, it will use a default. To select the gnuplot font, create a symbolic link from the desired font file to a file named "serif.ttf".  Then set GDFONTPATH to the directory where "serif.ttf" is located.  For example if the file /home/galactic/fonts/serif.ttf links to the desired serif font, then in the Bourne shell use a command such as the following:

export GDFONTPATH=/home/galactic/fonts:/usr/share/fonts

## Files

Upon exit, c-graph saves its sample sets and graphics files in the c-graphs directory within the current working directory.  Here is a typical recursive listing of the output directory contents:

``` \$ ls -R c-graphs
c-graphs:
coms  graphs

c-graphs/coms:
convolutions.cg  signals.cg  time.dat  trans.dat  transforms.cg

c-graphs/graphs:
convolutions.png  signals.png  transforms.png```

The c-graphs/coms directory contains the input for Gnuplot that was used to generate the output graphics.  Files ending in ".cg" are Gnuplot command files.  Files ending in ".dat" are ASCII data input files; they are tables of floating point values of input waveforms.

The c-graphs/graphs directory contains the graphics output of Gnuplot, in Portable Network Graphics (PNG) format.  These files can be used in presentations and other documents to visually demonstrate the convolution theorem.

## Bugs

Report bugs to agt@codeartnow.com.

## Author

GNU C-Graph was written by Adrienne Gaye Thompson (agt@codeartnow.com). This package evolved from the BSc. Electrical Engineering honours dissertation of Adrienne Thompson, "Interactive Computer Program Demonstrating: Sampling Convolution and the FFT", University of Aberdeen, Scotland (1983).