Sinusoid1DParam.h

Classes

Sinusoid1DParam -- Parameter handling for one dimensional Sinusoid class (full description)

template<class T> class Sinusoid1DParam : public Function1D<T>

Types

enum

AMPLITUDE = 0
PERIOD
X0

Interface

Public Members
Sinusoid1DParam()
explicit Sinusoid1DParam(const T &amplitude)
Sinusoid1DParam(const T &amplitude, const T &period)
Sinusoid1DParam(const T &amplitude, const T &period, const T &x0)
Sinusoid1DParam(const Sinusoid1DParam &other)
template <class W> Sinusoid1DParam(const Sinusoid1DParam<W> &other) : Function1D<T>(other)
Sinusoid1DParam<T> &operator=(const Sinusoid1DParam<T> &other)
virtual ~Sinusoid1DParam()
virtual const String &name() const
T amplitude() const
void setAmplitude(const T &amplitude)
T x0() const
void setX0(const T &x0)
T period() const
void setPeriod(const T &period)

Description

Prerequisite

Etymology

A 1-dimensional sinusoid's parameters.

Synopsis

A Sinusoid1D is described by an amplitude, a period, and a location of a peak. The parameters (amplitude, period, and x0) may be changed at run time.

The functional form is A*cos(2*pi(x-x0)/P)

The parameter interface (see FunctionParam class), is used to provide an interface to the Fitting classes.

There are 3 parameters that are used to describe the Sinusoid:

  1. The amplitude of the Sinusoid. This is the value returned using the amplitude member function.
  2. The period of the Sinusoid in the x direction. This is the value returned using the period member function. The period is expressed in full cycles.
  3. The location of a peak of the Sinusoid (i.e. where x=pi+k.2pi)

An enumeration for the AMPLITUDE, PERIOD and X0 parameter index is provided.

This class is in general used implicitly by the Sinusoid1D class only.

Example

    Sinusoid1D<Double> sf(5.0, 25.0, 7);
    sf(25);            // = -4.911
    sf.setAmplitude(1.0);
    sf[Sinusoid1D<Double>::PERIOD] = 2.0;                
    sf.setX0(0.0);
    sf(0.5);             // = 1.0

Template Type Argument Requirements (T)

Thrown Exceptions

Member Description

enum

Parameter numbers

Sinusoid1DParam()
explicit Sinusoid1DParam(const T &amplitude)
Sinusoid1DParam(const T &amplitude, const T &period)
Sinusoid1DParam(const T &amplitude, const T &period, const T &x0)

Constructs the Sinusoids, Defaults: amplitude=1, period==1, x0=0. I.e. a cosinusoid with cos(x).
Warning Could not use default arguments that worked both with gcc and IRIX

Sinusoid1DParam(const Sinusoid1DParam &other)
template <class W> Sinusoid1DParam(const Sinusoid1DParam<W> &other) : Function1D<T>(other)

Copy constructor (deep copy)

Sinusoid1DParam<T> &operator=(const Sinusoid1DParam<T> &other)

Copy assignment (deep copy)

virtual ~Sinusoid1DParam()

Destructor

virtual const String &name() const

Give name of function

T amplitude() const
void setAmplitude(const T &amplitude)

Get or set the amplitude of the Sinusoid

T x0() const
void setX0(const T &x0)

Get or set the x0 of the Sinusoid, the location of a peak.

T period() const
void setPeriod(const T &period)

Get or set the period of the Sinusoid in full cycles.