ifi.dsb
Class FrequencyAxis

java.lang.Object
  extended byifi.dsb.AxisValues
      extended byifi.dsb.FrequencyAxis

public class FrequencyAxis
extends AxisValues

Class for creation of frequency axis for use in plotting. Objects can hold axis values, a value for sampling rate and axis mode.

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

Field Summary
static int NEGATIVE_HALF
          NEGATIVE_HALF mode will give an axis with values from minus half the sampling-rate (inclusive if length is even, exclusive otherwise) to zero (inclusive).
static int POSITIVE_FULL
          POSITIVE_FULL mode will give an axis with values from zero (inclusive) to the sampling-rate (exclusive).
static int POSITIVE_HALF
          POSITIVE_HALF mode will give an axis with values from zero (inclusive) to half the sampling-rate (inclusive if length is even, exclusive otherwise).
static int SYMMETRIC
          SYMMETRIC mode will give an axis with values from minus half the sampling-rate (inclusive if length is even) to plus half the sampling-rate (exclusive).
 
Constructor Summary
FrequencyAxis(double[] frequencies)
          Constructs FrequencyAxis object.
FrequencyAxis(double[] frequencies, java.lang.String label)
          Constructs FrequencyAxis object.
FrequencyAxis(double samplingRate, int length)
          Constructs FrequencyAxis object.
FrequencyAxis(double samplingRate, int length, int mode)
          Constructs FrequencyAxis object.
FrequencyAxis(double samplingRate, int length, int mode, java.lang.String label)
          Constructs FrequencyAxis object.
FrequencyAxis(double samplingRate, int length, java.lang.String label)
          Constructs FrequencyAxis object.
FrequencyAxis(int length)
          Constructs FrequencyAxis object.
 
Method Summary
 int getFullLength()
          Return the number of bins for a full-period frequency axis.
 int getMode()
          Return axis mode, one of POSITIVE_HALF, POSITIVE_FULL, SYMMETRIC or NEGATIVE_HALF.
 double getSamplingRate()
          Return the sampling rate.
static void main(java.lang.String[] args)
           
 void setMode(int mode)
          Set the axis mode, one of POSITIVE_HALF, POSITIVE_FULL, SYMMETRIC or NEGATIVE_HALF.
 
Methods inherited from class ifi.dsb.AxisValues
getLabel, getLength, getMax, getMin, getValues, setLabel, setLength, setMax, setMin, updateValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEGATIVE_HALF

public static final int NEGATIVE_HALF
NEGATIVE_HALF mode will give an axis with values from minus half the sampling-rate (inclusive if length is even, exclusive otherwise) to zero (inclusive).

See Also:
Constant Field Values

POSITIVE_HALF

public static final int POSITIVE_HALF
POSITIVE_HALF mode will give an axis with values from zero (inclusive) to half the sampling-rate (inclusive if length is even, exclusive otherwise).

See Also:
Constant Field Values

SYMMETRIC

public static final int SYMMETRIC
SYMMETRIC mode will give an axis with values from minus half the sampling-rate (inclusive if length is even) to plus half the sampling-rate (exclusive).

See Also:
Constant Field Values

POSITIVE_FULL

public static final int POSITIVE_FULL
POSITIVE_FULL mode will give an axis with values from zero (inclusive) to the sampling-rate (exclusive).

See Also:
Constant Field Values
Constructor Detail

FrequencyAxis

public FrequencyAxis(double samplingRate,
                     int length)
Constructs FrequencyAxis object. Axis mode is set equal to POSITIVE_FULL.

Parameters:
samplingRate -
length - Number of bins for a full-period frequency axis.

FrequencyAxis

public FrequencyAxis(double samplingRate,
                     int length,
                     java.lang.String label)
Constructs FrequencyAxis object. Axis mode is set equal to POSITIVE_FULL.

Parameters:
samplingRate -
length - Number of bins for a full-period frequency axis.
label - Axis label.

FrequencyAxis

public FrequencyAxis(int length)
Constructs FrequencyAxis object. Axis mode is set equal to POSITIVE_FULL.

Parameters:
length - Number of bins for a full-period frequency axis.

FrequencyAxis

public FrequencyAxis(double[] frequencies)
Constructs FrequencyAxis object. Sampling rate is set equal to the last value in data.

Parameters:
frequencies - Frequency bins, assuming a full-period frequency axis valid for axis mode equal to POSITIVE_FULL.

FrequencyAxis

public FrequencyAxis(double[] frequencies,
                     java.lang.String label)
Constructs FrequencyAxis object. Sampling rate is set equal to the last value in data.

Parameters:
frequencies - Frequency bins, assuming a full-period frequency axis valid for axis mode equal to POSITIVE_FULL.
label - Axis label.

FrequencyAxis

public FrequencyAxis(double samplingRate,
                     int length,
                     int mode)
Constructs FrequencyAxis object. Minimum value is set to zero or -0.5 * samplingRate, depending on the axis mode. Maximum value is set to zero, 0.5 * samplingRate or samplingRate, depending on the axis mode.

Parameters:
samplingRate - Value for sampling rate stored in the object.
length - Number of frequency bins (for full-period frequency axis).
mode - Type of axis, one of POSITIVE_HALF ([0, samplingRate/2]), NEGATIVE_HALF ([-samplingRate/2, 0]), SYMMETRIC ([-samplingRate/2, samplingRate/2]), POSITIVE_FULL ([0, samplingRate]).

FrequencyAxis

public FrequencyAxis(double samplingRate,
                     int length,
                     int mode,
                     java.lang.String label)
Constructs FrequencyAxis object. Minimum value is set to zero or -0.5 * samplingRate, depending on the axis mode. Maximum value is set to zero, 0.5 * samplingRate or samplingRate, depending on the axis mode.

Parameters:
samplingRate - Value for sampling rate stored in the object.
length - Number of frequency bins (for full-period frequency axis).
mode - Type of axis, one of POSITIVE_HALF ([0, samplingRate/2]), NEGATIVE_HALF ([-samplingRate/2, 0]), SYMMETRIC ([-samplingRate/2, samplingRate/2]), POSITIVE_FULL ([0, samplingRate]).
label - Axis label.
Method Detail

getMode

public int getMode()
Return axis mode, one of POSITIVE_HALF, POSITIVE_FULL, SYMMETRIC or NEGATIVE_HALF.


setMode

public void setMode(int mode)
Set the axis mode, one of POSITIVE_HALF, POSITIVE_FULL, SYMMETRIC or NEGATIVE_HALF.


getFullLength

public int getFullLength()
Return the number of bins for a full-period frequency axis.


getSamplingRate

public double getSamplingRate()
Return the sampling rate.


main

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