Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qlibs::derivative Class Reference

A numerical derivative class. More...

#include <numa.hpp>

Inheritance diagram for qlibs::derivative:
qlibs::nState

Public Member Functions

virtual ~derivative ()
 
 derivative (const real_t timeStep, const real_t initialCondition=0.0_re)
 Constructs a derivative block with a given timeStep and optional initial condition.
 
real_t operator() (const real_t xt)
 Computes the numerical derivative based on the current input value.
 
- Public Member Functions inherited from qlibs::nState
virtual ~nState ()
 
 nState (const real_t x0=0.0_re, const real_t sn_1=0.0_re, const real_t sn_2=0.0_re) noexcept
 Constructor for the state object.
 
void init (const real_t x0=0.0_re, const real_t sn_1=0.0_re, const real_t sn_2=0.0_re) noexcept
 Initialize the state object.
 
real_t integrate (const real_t s, const real_t dt, const bool bUpdate=true) noexcept
 Perform a numerical integration step by using the specified integration method.
 
real_t derive (const real_t s, const real_t dt, const bool bUpdate=true) noexcept
 Perform a numerical derivation step by using the specified derivation method.
 
void setIntegrationMethod (integrationMethod m) noexcept
 Sets the numerical integration method.
 
void setDerivationMethod (derivationMethod m) noexcept
 Sets the numerical derivation method.
 
real_t operator() (void) const noexcept
 Get the value of the state.
 

Detailed Description

A numerical derivative class.

A numerical derivative class that can be used to compute in real-time the numerical approximations of derivatives for data values sampled periodically.

Constructor & Destructor Documentation

◆ ~derivative()

virtual qlibs::derivative::~derivative ( )
inlinevirtual

◆ derivative()

derivative::derivative ( const real_t timeStep,
const real_t initialCondition = 0.0_re )

Constructs a derivative block with a given timeStep and optional initial condition.

Parameters
[in]timeStepThe fixed time step (dt) used to compute the derivative.
[in]initialConditionThe initial input value. Default is 0.0
Note
It is assumed that input samples will be provided at regular intervals of timeStep.

Member Function Documentation

◆ operator()()

real_t derivative::operator() ( const real_t xt)

Computes the numerical derivative based on the current input value.

Parameters
[in]xtThe current input value.
Returns
The estimated derivative of the input signal.
Note
This should be called at intervals equal to the time step provided in the constructor.