ifi.dsb
Class TriangleGenerator

java.lang.Object
  extended byifi.dsb.WaveGenerator
      extended byifi.dsb.TriangleGenerator
All Implemented Interfaces:
PeriodicGenerator, SignalGenerator

public class TriangleGenerator
extends WaveGenerator

Generator for discretized periodic triangular wave.

Author:
Svein Bøe, svein@ifi.uio.no, 2002-2003.
See Also:
SineGenerator, SquareGenerator

Field Summary
 
Fields inherited from interface ifi.dsb.SignalGenerator
DEFAULT_SAMPLING_RATE, TWO_PI
 
Constructor Summary
TriangleGenerator()
           
TriangleGenerator(double frequency)
           
TriangleGenerator(double amplitude, double frequency)
           
TriangleGenerator(double amplitude, double frequency, double phase)
           
TriangleGenerator(double amplitude, double frequency, double phase, double samplingRate)
           
TriangleGenerator(double amplitude, double frequency, double phase, double samplingRate, java.lang.String name)
           
 
Method Summary
 void fun(double[] values, int n1)
          Fill the values array with generated sample values, starting at a specific sample number.
 double fun(int n)
          Return generated value for a specific sample number.
 double[] fun(int n1, int n2)
          Return an array of samples (indexed from zero) for the sample numbers in the closed interval [n1, n2].
static void main(java.lang.String[] args)
           
 
Methods inherited from class ifi.dsb.WaveGenerator
getAmplitude, getFrequency, getName, getOmega, getPhase, getSamplingRate, setAmplitude, setFrequency, setName, setOmega, setPhase, setSamplingRate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriangleGenerator

public TriangleGenerator()

TriangleGenerator

public TriangleGenerator(double frequency)

TriangleGenerator

public TriangleGenerator(double amplitude,
                         double frequency)

TriangleGenerator

public TriangleGenerator(double amplitude,
                         double frequency,
                         double phase)

TriangleGenerator

public TriangleGenerator(double amplitude,
                         double frequency,
                         double phase,
                         double samplingRate)

TriangleGenerator

public TriangleGenerator(double amplitude,
                         double frequency,
                         double phase,
                         double samplingRate,
                         java.lang.String name)
Method Detail

fun

public double fun(int n)
Description copied from interface: SignalGenerator
Return generated value for a specific sample number.


fun

public double[] fun(int n1,
                    int n2)
Description copied from interface: SignalGenerator
Return an array of samples (indexed from zero) for the sample numbers in the closed interval [n1, n2].

Parameters:
n1 - First sample number.
n2 - Last sample number.

fun

public void fun(double[] values,
                int n1)
Description copied from interface: SignalGenerator
Fill the values array with generated sample values, starting at a specific sample number.

Parameters:
values - Array to be filled with generator values. All array locations are filled with values. Indexed from zero.
n1 - Starting sample number in generator function.

main

public static void main(java.lang.String[] args)