Simbody
3.4 (development)
|
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...
#include <Function.h>
Public Member Functions | |
Sinusoid (Real amplitude, Real frequency, Real phase=0) | |
Create a Function::Sinusoid object, returning a*sin(w*x+p). | |
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 |
Calculate the value of this function at a particular point. | |
virtual Real | calcDerivative (const Array_< int > &derivComponents, const Vector &x) const |
Calculate a partial derivative of this function at a particular point. | |
virtual int | getArgumentSize () const |
Get the number of components expected in the input vector. | |
virtual int | getMaxDerivativeOrder () const |
Get the maximum derivative order this Function_ object can calculate. | |
Real | calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const |
This provides compatibility with std::vector without requiring any copying. |
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.
SimTK::Function_< T >::Sinusoid::Sinusoid | ( | Real | amplitude, |
Real | frequency, | ||
Real | phase = 0 |
||
) | [inline] |
Create a Function::Sinusoid object, returning a*sin(w*x+p).
[in] | amplitude | 'a' in the above formula |
[in] | frequency | 'w' in the above formula |
[in] | phase | 'p' in the above formula |
void SimTK::Function_< T >::Sinusoid::setAmplitude | ( | Real | amplitude | ) | [inline] |
void SimTK::Function_< T >::Sinusoid::setFrequency | ( | Real | frequency | ) | [inline] |
void SimTK::Function_< T >::Sinusoid::setPhase | ( | Real | phase | ) | [inline] |
Real SimTK::Function_< T >::Sinusoid::getAmplitude | ( | ) | const [inline] |
Real SimTK::Function_< T >::Sinusoid::getFrequency | ( | ) | const [inline] |
Real SimTK::Function_< T >::Sinusoid::getPhase | ( | ) | const [inline] |
virtual Real SimTK::Function_< T >::Sinusoid::calcValue | ( | const Vector & | x | ) | const [inline, virtual] |
Calculate the value of this function at a particular point.
x | the Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Implements SimTK::Function_< Real >.
virtual Real SimTK::Function_< T >::Sinusoid::calcDerivative | ( | const Array_< int > & | derivComponents, |
const Vector & | x | ||
) | const [inline, virtual] |
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.
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(). |
Implements SimTK::Function_< Real >.
virtual int SimTK::Function_< T >::Sinusoid::getArgumentSize | ( | ) | const [inline, virtual] |
Get the number of components expected in the input vector.
Implements SimTK::Function_< Real >.
virtual int SimTK::Function_< T >::Sinusoid::getMaxDerivativeOrder | ( | ) | const [inline, virtual] |
Get the maximum derivative order this Function_ object can calculate.
Implements SimTK::Function_< Real >.
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.
Reimplemented from SimTK::Function_< Real >.