Package ptolemy.math

Class 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).
    • Constructor Summary

      Constructors 
      Constructor Description
      SinusoidSampleGenerator​(double frequency, double phase)
      Construct a SinusoidSampleGenerator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
    • Constructor Detail

      • SinusoidSampleGenerator

        public 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.
    • Method Detail

      • 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.