ifi.dsb
Class SquareGenerator

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

public class SquareGenerator
extends WaveGenerator

Generator for discretized periodic square wave.

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

Field Summary
 
Fields inherited from interface ifi.dsb.SignalGenerator
DEFAULT_SAMPLING_RATE, TWO_PI
 
Constructor Summary
SquareGenerator()
           
SquareGenerator(double frequency)
           
SquareGenerator(double amplitude, double frequency)
           
SquareGenerator(double amplitude, double frequency, double phase)
           
SquareGenerator(double amplitude, double frequency, double phase, double samplingRate)
           
SquareGenerator(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].
 
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

SquareGenerator

public SquareGenerator()

SquareGenerator

public SquareGenerator(double frequency)

SquareGenerator

public SquareGenerator(double amplitude,
                       double frequency)

SquareGenerator

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

SquareGenerator

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

SquareGenerator

public SquareGenerator(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.