libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
Data Structures | Functions
hp_filter.h File Reference
#include "core.h"
Include dependency graph for hp_filter.h:

Go to the source code of this file.

Data Structures

struct  hp_filter_t
 

Functions

static void hp_filter_init (hp_filter_t *filt, double f_cutoff)
 
static double hp_filter_update (hp_filter_t *filt, double m, double d_t)
 
static double hp_filter_get (const hp_filter_t *filt)
 
static void hp_filter_set_f_cutoff (hp_filter_t *filt, double f_cutoff)
 
static double hp_filter_get_f_cutoff (const hp_filter_t *filt)
 

Detailed Description

This module contains a header-implementation of a high-pass filter.

See also
hp_filter_t
hp_filter_init()
hp_filter_update()

Definition in file hp_filter.h.

Function Documentation

◆ hp_filter_get()

static double hp_filter_get ( const hp_filter_t filt)
static
Returns
The current output of a high-pass filter without updating the filter's state.
Note
The filter needs at least 2 measurements before it can start providing valid output. The filter's output will be NAN before that.
See also
hp_filter_update()

Definition at line 113 of file hp_filter.h.

◆ hp_filter_get_f_cutoff()

static double hp_filter_get_f_cutoff ( const hp_filter_t filt)
static
Returns
The current cutoff frequency (in Hz) for a high-pass filter.

Definition at line 136 of file hp_filter.h.

◆ hp_filter_init()

static void hp_filter_init ( hp_filter_t filt,
double  f_cutoff 
)
static

Initializes a high-pass filter.

Parameters
filtThe filter to be initialized.
f_cutoffFilter cutoff frequency in Hz.
See also
hp_filter_t

Definition at line 65 of file hp_filter.h.

◆ hp_filter_set_f_cutoff()

static void hp_filter_set_f_cutoff ( hp_filter_t filt,
double  f_cutoff 
)
static

Sets a new cutoff frequency for a high-pass filter.

Parameters
filtThe filter for which to change the cutoff frequency.
f_cutoffNew cutoff frequency to set (in Hz).

Definition at line 125 of file hp_filter.h.

◆ hp_filter_update()

static double hp_filter_update ( hp_filter_t filt,
double  m,
double  d_t 
)
static

Updates a high-pass filter with a new input value. You want to call this every time a new measurement is obtained, which you want to filter.

Parameters
filtThe filter to be updated.
mThe new measurement to be integrated into the filter.
d_tDelta-time in seconds since the last filter update.
Returns
The current filter output after the update has been performed.
Note
The filter needs at least 2 measurements before it can start providing valid output. The filter's output will be NAN before that.
See also
hp_filter_get()

Definition at line 88 of file hp_filter.h.