Simbody  3.6
SimTK::Function_< T >::Sinusoid Class Reference

This is a Function_ subclass whose output value is a sinusoid of its argument: f(x) = a*sin(w*x + p) where a is amplitude, w is frequency in radians per unit of x, p is phase in radians. More...

+ Inheritance diagram for SimTK::Function_< T >::Sinusoid:

Public Member Functions

 Sinusoid (Real amplitude, Real frequency, Real phase=0)
 Create a Function::Sinusoid object, returning a*sin(w*x+p). More...
 
void setAmplitude (Real amplitude)
 
void setFrequency (Real frequency)
 
void setPhase (Real phase)
 
Real getAmplitude () const
 
Real getFrequency () const
 
Real getPhase () const
 
virtual Real calcValue (const Vector &x) const override
 Calculate the value of this function at a particular point. More...
 
virtual Real calcDerivative (const Array_< int > &derivComponents, const Vector &x) const override
 Calculate a partial derivative of this function at a particular point. More...
 
int getArgumentSize () const override
 
int getMaxDerivativeOrder () const override
 
Sinusoidclone () const override
 
Real calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 
- Public Member Functions inherited from SimTK::Function_< Real >
virtual ~Function_ ()
 
Real calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 
virtual int getArgumentSize () const=0
 Get the number of components expected in the input vector. More...
 
virtual int getMaxDerivativeOrder () const=0
 Get the maximum derivative order this Function_ object can calculate. More...
 
virtual Function_clone () const
 Create a new heap-allocated copy of this concrete Function. More...
 

Detailed Description

template<class T>
class SimTK::Function_< T >::Sinusoid

This is a Function_ subclass whose output value is a sinusoid of its argument: f(x) = a*sin(w*x + p) where a is amplitude, w is frequency in radians per unit of x, p is phase in radians.

This is only defined for a scalar (Real) return value.

Constructor & Destructor Documentation

◆ Sinusoid()

template<class T >
SimTK::Function_< T >::Sinusoid::Sinusoid ( Real  amplitude,
Real  frequency,
Real  phase = 0 
)
inline

Create a Function::Sinusoid object, returning a*sin(w*x+p).

Parameters
[in]amplitude'a' in the above formula
[in]frequency'w' in the above formula
[in]phase'p' in the above formula (default is zero)

Member Function Documentation

◆ setAmplitude()

template<class T >
void SimTK::Function_< T >::Sinusoid::setAmplitude ( Real  amplitude)
inline

◆ setFrequency()

template<class T >
void SimTK::Function_< T >::Sinusoid::setFrequency ( Real  frequency)
inline

◆ setPhase()

template<class T >
void SimTK::Function_< T >::Sinusoid::setPhase ( Real  phase)
inline

◆ getAmplitude()

template<class T >
Real SimTK::Function_< T >::Sinusoid::getAmplitude ( ) const
inline

◆ getFrequency()

template<class T >
Real SimTK::Function_< T >::Sinusoid::getFrequency ( ) const
inline

◆ getPhase()

template<class T >
Real SimTK::Function_< T >::Sinusoid::getPhase ( ) const
inline

◆ calcValue()

template<class T >
virtual Real SimTK::Function_< T >::Sinusoid::calcValue ( const Vector x) const
inlineoverridevirtual

Calculate the value of this function at a particular point.

Parameters
xthe Vector of input arguments. Its size must equal the value returned by getArgumentSize().

Implements SimTK::Function_< Real >.

◆ calcDerivative() [1/2]

template<class T >
virtual Real SimTK::Function_< T >::Sinusoid::calcDerivative ( const Array_< int > &  derivComponents,
const Vector x 
) const
inlineoverridevirtual

Calculate a partial derivative of this function at a particular point.


Which derivative to take is specified by listing the input components with which to take it. For example, if derivComponents=={0}, that indicates a first derivative with respective to component 0. If derivComponents=={0, 0, 0}, that indicates a third derivative with respective to component 0. If derivComponents=={4, 7}, that indicates a partial second derivative with respect to components 4 and 7.

Parameters
derivComponents
The input components with respect to which the derivative should be taken. Its size must be less than or equal to the value returned by getMaxDerivativeOrder().
x
The Vector of input arguments. Its size must equal the value returned by getArgumentSize().
Returns
The value of the selected derivative, which is of type T.

Implements SimTK::Function_< Real >.

◆ getArgumentSize()

template<class T >
int SimTK::Function_< T >::Sinusoid::getArgumentSize ( ) const
inlineoverride

◆ getMaxDerivativeOrder()

template<class T >
int SimTK::Function_< T >::Sinusoid::getMaxDerivativeOrder ( ) const
inlineoverride

◆ clone()

template<class T >
Sinusoid* SimTK::Function_< T >::Sinusoid::clone ( ) const
inlineoverride

◆ calcDerivative() [2/2]

template<class T >
Real SimTK::Function_< T >::Sinusoid::calcDerivative ( const std::vector< int > &  derivComponents,
const Vector x 
) const
inline

This provides compatibility with std::vector without requiring any copying.


The documentation for this class was generated from the following file: