ptolemy.math
Class SignalProcessing.SinusoidSampleGenerator
java.lang.Object
ptolemy.math.SignalProcessing.SinusoidSampleGenerator
- All Implemented Interfaces:
- DoubleUnaryOperation
- Enclosing class:
- SignalProcessing
public static class SignalProcessing.SinusoidSampleGenerator
- extends java.lang.Object
- implements DoubleUnaryOperation
This class generates samples of a sinusoidal wave.
The function computed is :
h(t) = cos(frequency * t + phase)
where the argument is taken to be in radians.
To use this class to generate a sine wave, simply
set the phase to -Math.PI*0.5 from the
phase, since sin(t) = cos(t - PI/2).
Method Summary |
double |
operate(double time)
Operate on the operand, returning a value of the same type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_frequency
private final double _frequency
_phase
private final double _phase
SignalProcessing.SinusoidSampleGenerator
public SignalProcessing.SinusoidSampleGenerator(double frequency,
double phase)
- Construct a SinusoidSampleGenerator.
- Parameters:
frequency
- The frequency of the cosine wave, in radians per
unit time.phase
- The phase shift, in radians.
operate
public final double operate(double time)
- Description copied from interface:
DoubleUnaryOperation
- Operate on the operand, returning a value of the same type.
- Specified by:
operate
in interface DoubleUnaryOperation
- Parameters:
time
- The operand.
- Returns:
- The results of the operation.