Changes to be committed:

deleted:    dspl/doc/en/latex/Makefile
modified:   dspl/dox/doxyfile_en
modified:   dspl/dox/doxyfile_ru
modified:   dspl/dox/en/fft.dox
modified:   dspl/dox/en/filter_an.dox
modified:   dspl/dox/en/filter_ap.dox
modified:   dspl/dox/en/filter_fir.dox
modified:   dspl/dox/en/filter_ft.dox
modified:   dspl/dox/en/filter_iir.dox
modified:   dspl/dox/en/fourier_series.dox
modified:   dspl/src/dspl_internal.h
modified:   dspl/src/fft.c
modified:   dspl/src/fft_subkernel.c
modified:   examples/Makefile
modified:   examples/src/array_test.c
modified:   examples/src/bessel_i0.c
modified:   examples/src/butter_ap_test.c
modified:   examples/src/cheby1_ap_test.c
modified:   examples/src/cheby2_ap_test.c
modified:   examples/src/dft_test.c
modified:   examples/src/ellip_ap_test.c
modified:   examples/src/fft_cmplx_test.c
modified:   examples/src/fft_test.c
modified:   examples/src/idft_cmplx_test.c
modified:   examples/src/ifft_cmplx_test.c
pull/6/merge
Dsplib 2020-07-08 23:28:59 +03:00
rodzic 46fb728d56
commit adf9e6f06d
25 zmienionych plików z 1130 dodań i 1148 usunięć

Wyświetl plik

@ -1,23 +0,0 @@
LATEX_CMD=pdflatex
all: refman.pdf
pdf: refman.pdf
refman.pdf: clean refman.tex
$(LATEX_CMD) refman
makeindex refman.idx
$(LATEX_CMD) refman
latex_count=8 ; \
while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\
do \
echo "Rerunning latex...." ;\
$(LATEX_CMD) refman ;\
latex_count=`expr $$latex_count - 1` ;\
done
makeindex refman.idx
$(LATEX_CMD) refman
clean:
rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf

Wyświetl plik

@ -1,4 +1,4 @@
# Doxyfile 1.8.15
# Doxyfile 1.8.18
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@ -197,6 +197,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
# such as
# /***************
# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
# Javadoc-style will behave just like regular comments and it will not be
# interpreted by doxygen.
# The default value is: NO.
JAVADOC_BANNER = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@ -253,12 +263,6 @@ TAB_SIZE = 2
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@ -299,14 +303,14 @@ OPTIMIZE_OUTPUT_SLICE = NO
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
# tries to guess whether the code is fixed or free formatted code, this is the
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is
# Fortran), use: inc=Fortran f=C.
# default for Fortran type files). For instance to make doxygen treat .inc files
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
@ -329,7 +333,7 @@ MARKDOWN_SUPPORT = YES
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# Minimum value: 0, maximum value: 99, default value: 5.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
@ -465,6 +469,12 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
# The default value is: NO.
EXTRACT_PRIV_VIRTUAL = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@ -519,8 +529,8 @@ HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation.
# declarations. If set to NO, these declarations will be included in the
# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@ -543,7 +553,7 @@ INTERNAL_DOCS = NO
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# (including Cygwin) ands Mac users are advised to set this option to NO.
# The default value is: system dependent.
CASE_SENSE_NAMES = NO
@ -839,8 +849,10 @@ INPUT_ENCODING = UTF-8
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.c \
*.cc \
@ -1285,9 +1297,9 @@ HTML_TIMESTAMP = YES
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# are dynamically created via JavaScript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# page. Disable this option to support browsers that do not have JavaScript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
@ -1300,7 +1312,7 @@ HTML_DYNAMIC_MENUS = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_SECTIONS = NO
HTML_DYNAMIC_SECTIONS = YES
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
# shown in the various tree structured indices initially; the user can expand
@ -1438,7 +1450,7 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1446,7 +1458,7 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
# folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1455,7 +1467,7 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1463,7 +1475,7 @@ QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1471,7 +1483,7 @@ QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
@ -1512,7 +1524,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
DISABLE_INDEX = YES
DISABLE_INDEX = NO
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information. If the tag
@ -1555,6 +1567,17 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
# the HTML output. These images will generally look nicer at scaled resolutions.
# Possible values are: png The default and svg Looks nicer but requires the
# pdf2svg tool.
# The default value is: png.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FORMULA_FORMAT = png
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@ -1575,8 +1598,14 @@ FORMULA_FONTSIZE = 14
FORMULA_TRANSPARENT = YES
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# https://www.mathjax.org) which uses client side Javascript for the rendering
# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@ -1584,7 +1613,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
USE_MATHJAX = NO
USE_MATHJAX = YES
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
@ -1604,7 +1633,7 @@ MATHJAX_FORMAT = HTML-CSS
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
@ -1646,7 +1675,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@ -1750,10 +1779,11 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
# generate index for LaTeX.
# generate index for LaTeX. In case there is no backslash (\) as first character
# it will be automatically added in the LaTeX code.
# Note: This tag is used in the generated output file (.tex).
# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
# The default value is: \makeindex.
# The default value is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_MAKEINDEX_CMD = \makeindex
@ -2247,12 +2277,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
@ -2266,15 +2290,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = NO
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.

Wyświetl plik

@ -1,4 +1,4 @@
# Doxyfile 1.8.15
# Doxyfile 1.8.18
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@ -197,6 +197,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
# such as
# /***************
# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
# Javadoc-style will behave just like regular comments and it will not be
# interpreted by doxygen.
# The default value is: NO.
JAVADOC_BANNER = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@ -253,12 +263,6 @@ TAB_SIZE = 2
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@ -299,14 +303,14 @@ OPTIMIZE_OUTPUT_SLICE = NO
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
# tries to guess whether the code is fixed or free formatted code, this is the
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is
# Fortran), use: inc=Fortran f=C.
# default for Fortran type files). For instance to make doxygen treat .inc files
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
@ -329,7 +333,7 @@ MARKDOWN_SUPPORT = YES
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# Minimum value: 0, maximum value: 99, default value: 5.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
@ -465,6 +469,12 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
# The default value is: NO.
EXTRACT_PRIV_VIRTUAL = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@ -519,8 +529,8 @@ HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation.
# declarations. If set to NO, these declarations will be included in the
# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@ -543,7 +553,7 @@ INTERNAL_DOCS = NO
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# (including Cygwin) ands Mac users are advised to set this option to NO.
# The default value is: system dependent.
CASE_SENSE_NAMES = NO
@ -839,8 +849,10 @@ INPUT_ENCODING = UTF-8
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.c \
*.cc \
@ -1285,9 +1297,9 @@ HTML_TIMESTAMP = YES
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# are dynamically created via JavaScript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# page. Disable this option to support browsers that do not have JavaScript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
@ -1438,7 +1450,7 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1446,7 +1458,7 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
# folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1455,7 +1467,7 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1463,7 +1475,7 @@ QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1471,7 +1483,7 @@ QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
@ -1555,6 +1567,17 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
# the HTML output. These images will generally look nicer at scaled resolutions.
# Possible values are: png The default and svg Looks nicer but requires the
# pdf2svg tool.
# The default value is: png.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FORMULA_FORMAT = png
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@ -1575,8 +1598,14 @@ FORMULA_FONTSIZE = 14
FORMULA_TRANSPARENT = YES
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# https://www.mathjax.org) which uses client side Javascript for the rendering
# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@ -1584,7 +1613,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
USE_MATHJAX = NO
USE_MATHJAX = YES
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
@ -1604,7 +1633,7 @@ MATHJAX_FORMAT = HTML-CSS
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
@ -1646,7 +1675,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@ -1750,10 +1779,11 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
# generate index for LaTeX.
# generate index for LaTeX. In case there is no backslash (\) as first character
# it will be automatically added in the LaTeX code.
# Note: This tag is used in the generated output file (.tex).
# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
# The default value is: \makeindex.
# The default value is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_MAKEINDEX_CMD = \makeindex
@ -2247,12 +2277,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
@ -2266,15 +2290,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = NO
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.

Wyświetl plik

@ -8,13 +8,15 @@
\struct fft_t
\brief Fast Fourier Transform Object Data Structure
The structure stores pointers to twiddle factors and arrays of intermediate data of the fast Fourier transform algorithm.
The structure stores pointers to twiddle factors and arrays of intermediate
data of the fast Fourier transform algorithm.
The DSPL library uses an FFT algorithm for composite size.
\param n
The size of the FFT vector for which memory is allocated in the structure arrays. \n
The size of the FFT vector for which memory is allocated
in the structure arrays. \n
The parameter `n` must be equal to an integer power of two (radix 2). \n \n
@ -39,8 +41,9 @@ The structure is populated with the \ref fft_create function once
before using the FFT algorithm. \n
A pointer to an object of this structure may be
reused when calling FFT functions. \n
Before exiting the program, dedicated memory for twiddle factors and arrays of intermediate data
must be cleared by the \ref fft_free function. For example:
Before exiting the program, dedicated memory for twiddle factors and arrays of
intermediate data must be cleared by the \ref fft_free function.
For example:
\code
fft_t pfft = {0}; /* Structure fft_t and clear all fields */
int n = 64; /* FFT size */
@ -59,9 +62,10 @@ fft_free(&pfft);
\endcode
\note
It is important to note that if the object `fft_t` was created for the FFT size equal to` n`,
it can only be used for FFT of size `n`. \n \n
Its also worth noting that the FFT functions independently control the size, and independently allocate the memory of the FFT object, if necessary.
It is important to note that if the object `fft_t` was created for the FFT size
equal to` n`, it can only be used for FFT of size `n`. \n \n
Its also worth noting that the FFT functions independently control the size,
and independently allocate the memory of the FFT object, if necessary.
So if you call any function using the `fft_t` structure with filled
data for the FFT length `k` for calculating the FFT of length`n`,
then the structure arrays will be automatically recreated for the length `n`.
@ -81,52 +85,53 @@ then the structure arrays will be automatically recreated for the length `n`.
/*! ****************************************************************************
\ingroup DFT_GROUP
\fn int ifft_cmplx(complex_t* x, int n, fft_t* pfft, complex_t* y)
\brief Обратное быстрое преобразование Фурье
\brief Inverse fast Fourier transform
Функция рассчитывает \f$ n \f$-точечное обратное быстрое преобразование Фурье
от \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n
Function calculates \f$ n \f$-point IFFT of complex data
\f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n
\f[
Y(k) = \frac{1}{N} \sum_{m = 0}^{n-1} x(m) \exp
\left( j \frac{2\pi}{n} m k \right),
\f]
где \f$ k = 0 \ldots n-1 \f$.
here \f$ k = 0 \ldots n-1 \f$.
Для расчета используется алгоритм БПФ составной длины.
\param[in] x
Указатель на входной комплексный вектор \f$x(m)\f$,
Pointer to the input vector \f$x(m)\f$,
\f$ m = 0 \ldots n-1 \f$. \n
Размер вектора `[n x 1]`. \n \n
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер ОБПФ \f$n\f$. \n
Размер ОБПФ может быть составным вида
IFFT size \f$n\f$. \n
IFFT size can be composite:
\f$n = n_0 \times n_1 \times n_2 \times \ldots \times n_p \times m\f$,
где \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
произвольный простой множитель не превосходящий 46340
(см. описание функции \ref fft_create). \n \n
here \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
simple number less than 46340
(see \ref fft_create function). \n \n
\param[in] pfft
Указатель на структуру `fft_t`. \n
Указатель не должен быть `NULL`. \n
Структура \ref fft_t должна быть предварительно однократно
заполнена функцией \ref fft_create, и память должна быть
очищена перед выходом функцией \ref fft_free. \n \n
Pointer to the `fft_t` object. \n
This pointer cannot be `NULL`. \n
Structure \ref fft_t should be previously once
filled with the \ref fft_create function, and the memory should be
cleared before exiting by the \ref fft_free function. \n \n
\param[out] y
Указатель на вектор результата ОБПФ \f$Y(k)\f$,
\f$ k = 0 \ldots n-1 \f$. Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n \n
Pointer to the IFFT result vector \f$Y(k)\f$,
\f$ k = 0 \ldots n-1 \f$. \n
Vector size is `[n x 1]`. \n
Memory must be allocated. \n \n
\return
`RES_OK` если расчет произведен успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n \n
`RES_OK` if IFFT is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции `fft`:
IFFT example:
\include ifft_cmplx_test.c
Результат работы программы:
Result:
\verbatim
| x[ 0] = 1.000 0.000 | y[ 0] = -0.517 0.686 | z[ 0] = 1.000 0.000 |
@ -149,9 +154,7 @@ then the structure arrays will be automatically recreated for the length `n`.
| x[17] = -0.275 -0.961 | y[17] = -0.300 0.588 | z[17] = -0.275 -0.961 |
\endverbatim
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -160,53 +163,53 @@ www.dsplib.org
/*! ****************************************************************************
\ingroup DFT_GROUP
\fn int fft(double* x, int n, fft_t* pfft, complex_t* y)
\brief Быстрое преобразование Фурье вещественного сигнала
\brief Fast Fourier transform for the real vector.
Функция рассчитывает \f$ n \f$-точечное быстрое преобразование Фурье
вещественного сигнала \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n
Function calculated \f$ n \f$-points FFT for the real vector
\f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n
\f[
Y(k) = \sum_{m = 0}^{n-1} x(m) \exp
\left( -j \frac{2\pi}{n} m k \right),
\f]
где \f$ k = 0 \ldots n-1 \f$.
here \f$ k = 0 \ldots n-1 \f$.
Для расчета используется алгоритм БПФ составной длины.
\param[in] x
Указатель на вектор вещественного входного сигнала \f$x(m)\f$,
Pointer to the input real vector \f$x(m)\f$,
\f$ m = 0 \ldots n-1 \f$. \n
Размер вектора `[n x 1]`. \n \n
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер БПФ \f$n\f$. \n
Размер БПФ может быть составным вида
FFT size \f$n\f$. \n
FFT size can be composite:
\f$n = n_0 \times n_1 \times n_2 \times \ldots \times n_p \times m\f$,
где \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
произвольный простой множитель не превосходящий 46340
(см. описание функции \ref fft_create). \n \n
here \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
simple number less than 46340
(see \ref fft_create function). \n \n
\param[in] pfft
Указатель на структуру `fft_t`. \n
Указатель не должен быть `NULL`. \n
Структура \ref fft_t должна быть предварительно однократно
заполнена функцией \ref fft_create, и память должна быть
очищена перед выходом функцией \ref fft_free. \n \n
Pointer to the `fft_t` object. \n
This pointer cannot be `NULL`. \n
Structure \ref fft_t should be previously once
filled with the \ref fft_create function, and the memory should be
cleared before exiting by the \ref fft_free function. \n \n
\param[out] y
Указатель на комплексный вектор результата БПФ \f$Y(k)\f$,
Pointer to the FFT result complex vector \f$Y(k)\f$,
\f$ k = 0 \ldots n-1 \f$. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n \n
Vector size is `[n x 1]`. \n
Memory must be allocated. \n \n
\return
`RES_OK` если расчет произведен успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n \n
`RES_OK` if FFT is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции `fft`:
Example:
\include fft_test.c
Результат работы программы:
Result:
\verbatim
y[ 0] = 91.000 0.000
@ -225,9 +228,7 @@ y[12] = -7.000 -14.536
y[13] = -7.000 -30.669
\endverbatim
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -238,54 +239,52 @@ www.dsplib.org
/*! ****************************************************************************
\ingroup DFT_GROUP
\fn int fft_cmplx(complex_t* x, int n, fft_t* pfft, complex_t* y)
\brief Быстрое преобразование Фурье комплексного сигнала
\brief Fast Fourier transform for the complex vector.
Функция рассчитывает \f$ n \f$-точечное быстрое преобразование Фурье
комплексного сигнала \f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n
Function calculated \f$ n \f$-points FFT for the complex vector
\f$ x(m) \f$, \f$ m = 0 \ldots n-1 \f$. \n
\f[
Y(k) = \sum_{m = 0}^{n-1} x(m) \exp
\left( -j \frac{2\pi}{n} m k \right),
\left( -j \frac{2\pi}{n} m k \right),
\f]
где \f$ k = 0 \ldots n-1 \f$.
Для расчета используется алгоритм БПФ составной длины.
here \f$ k = 0 \ldots n-1 \f$.
\param[in] x
Указатель на вектор комплексного
входного сигнала \f$x(m)\f$, \f$ m = 0 \ldots n-1 \f$. \n
Размер вектора `[n x 1]`. \n \n
Pointer to the input complex vector \f$x(m)\f$,
\f$ m = 0 \ldots n-1 \f$. \n
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер БПФ \f$n\f$. \n
Размер БПФ может быть составным вида
\f$n = n_0 \times n_1 \times n_2 \times n_3 \times \ldots \times n_p \times m\f$,
где \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
произвольный простой множитель не превосходящий 46340
(см. описание функции \ref fft_create). \n \n
FFT size \f$n\f$. \n
FFT size can be composite:
\f$n = n_0 \times n_1 \times n_2 \times \ldots \times n_p \times m\f$,
here \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
simple number less than 46340
(see \ref fft_create function). \n \n
\param[in] pfft
Указатель на структуру `fft_t`. \n
Указатель не должен быть `NULL`. \n
Структура \ref fft_t должна быть предварительно однократно
заполнена функцией \ref fft_create, и память должна быть
очищена перед выходом функцией \ref fft_free. \n \n
Pointer to the `fft_t` object. \n
This pointer cannot be `NULL`. \n
Structure \ref fft_t should be previously once
filled with the \ref fft_create function, and the memory should be
cleared before exiting by the \ref fft_free function. \n \n
\param[out] y
Указатель на комплексный вектор
результата БПФ \f$Y(k)\f$,
\f$ k = 0 \ldots n-1 \f$.
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n \n
Pointer to the FFT result complex vector \f$Y(k)\f$,
\f$ k = 0 \ldots n-1 \f$. \n
Vector size is `[n x 1]`. \n
Memory must be allocated. \n \n
\return
`RES_OK` если расчет произведен успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n \n
`RES_OK` if FFT is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции `fft`:
Example:
\include fft_cmplx_test.c
Результат работы программы:
Result:
\verbatim
y[ 0] = -0.517 0.686
@ -308,9 +307,7 @@ y[16] = -0.161 0.525
y[17] = -0.300 0.588
\endverbatim
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -319,74 +316,64 @@ www.dsplib.org
/*! ****************************************************************************
\ingroup DFT_GROUP
\fn int fft_create(fft_t* pfft, int n)
\brief Заполнение структуры `fft_t` для алгоритма БПФ
\brief Function creates and fill `fft_t` structure.
Функция производит выделение памяти и рассчет векторов
поворотных коэффициентов `n`-точечного БПФ для структуры `fft_t`.
The function allocates memory and calculates twiddle factors
of the `n`-point FFT for the structure` fft_t`.
\param[in,out] pfft
Указатель на структуру `fft_t`. \n
Указатель не должен быть `NULL`. \n \n
Pointer to the `fft_t` object. \n
Pointer cannot be `NULL`. \n \n
\param[in] n
Размер БПФ \f$n\f$. \n
Размер БПФ может быть составным вида
FFT size \f$n\f$. \n
FFT size can be composite
\f$n = n_0 \times n_1 \times n_2 \ldots \times n_p \times m\f$,
где \f$n_i = 2,3,5,7\f$, а \f$m \f$ --
произвольный простой множитель не превосходящий 46340. \n
Таким образом алгоритм БПФ поддерживает произвольные длины, равные целой
степени чисел 2,3,5,7, а также различные их комбинации. \n
Так например, при \f$ n = 725760 \f$ структура будет успешно заполнена,
потому что
\f$725760 = 2 \cdot 3 \cdot 4 \cdot 5 \cdot 6 \cdot 7 \cdot 9 \cdot 16 \f$,
т.е. получается как произведение множителей 2,3,5,7. \n
При \f$ n = 172804 = 43201 \cdot 4 \f$ структура также будет успешно заполнена,
потому что простой множитель входящий в \f$n\f$ не превосходит 46340. \n
Для размера \f$ n = 13 \cdot 17 \cdot 23 \cdot 13 = 66079 \f$
функция вернет ошибку, поскольку 66079 больше 46340 и не является результатом
произведения чисел 2,3,5,7. \n \n
here \f$n_i = 2,3,5,7\f$, and \f$m \f$ --
arbitrary prime factor not exceeding 46340. \n
Thus, the FFT algorithm supports arbitrary integer lengths.
degrees of numbers 2,3,5,7, as well as their various combinations. \n
For example, with \f$ n = 725760 \f$ the structure will be successfully filled,
because
\f$ 725760 = 2 \cdot 3 \cdot 4 \cdot 5 \cdot 6 \cdot 7 \cdot 9 \cdot 16 \f$. \n
If \f$ n = 172804 = 43201 \cdot 4 \f$ then the structure will also be
successfully filled, because the simple factor in \f$ n \f$ does not
exceed 46340. \n
For size \f$ n = 13 \cdot 17 \cdot 23 \cdot 13 = 66079 \f$
the function will return an error since 66079 is greater than 46340 and is
not the result of the product of numbers 2,3,5,7. \n \n
\return
`RES_OK` если структура заполнена успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n \n
`RES_OK` if FFT structure is created and filled successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\note
Некоторые компиляторы при создании структуры не обнуляют ее содержимое.
Поэтому рекомендуется произвести обнуление структуры после ее объявления:
Some compilers do not nullify its contents when creating a structure.
Therefore, it is recommended to reset the structure after its declaration:
\code{.cpp}
fft_t pfft; /* объявляем объект fft_t */
int n = 64; /* Размер БПФ */
/*
бнуляем все поля и указатели.
Данные шаг рекомендуется ввиду того, что некоторые
компиляторы при создании переменной не инициализируют ее нулем.
*/
memset(&pfft, 0, sizeof(fft_t));
fft_t pfft = {0}; /* fill and fields of fft_t as zeros*/
int n = 64; /* FFT size */
int err;
/* создаем объект для 64-точечного БПФ */
/* Create fft_t object for 64-points FFT */
err = fft_create(&pfft, n);
/* ................................... */
/* очистить память объекта БПФ */
/* Clear fft_t structure */
fft_free(&pfft);
\endcode
Перед выходом из программы выделенную в структуре память
необходимо очистить функцией \ref fft_free . \n \n
Before exiting the program, the memory allocated in the structure
need to clear by \ref fft_free function. \n \n
\note
Магия числа 46340 заключается в том, что \f$\sqrt{2^{31}} = 46340.95\f$. \n
The "magic number" 46340 because \f$\sqrt{2^{31}} = 46340.95\f$. \n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -400,17 +387,15 @@ www.dsplib.org
/*! ****************************************************************************
\ingroup DFT_GROUP
\fn void fft_free(fft_t *pfft)
\brief Очистить структуру `fft_t` алгоритма БПФ
\brief Free `fft_t` structure.
Функция производит очищение памяти промежуточных данных
и векторов поворотных коэффициентов структуры `fft_t`.
The function clears the intermediate data memory
and vectors of FFT twiddle factors of the structure `fft_t`.
\param[in] pfft
Указатель на структуру `fft_t`. \n
Pointer to the `fft_t` object. \n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -423,34 +408,28 @@ www.dsplib.org
/*! ****************************************************************************
\ingroup DFT_GROUP
\fn int fft_shift(double* x, int n, double* y)
\brief Перестановка спектральных отсчетов дискретного преобразования Фурье
Функция производит
<a href="http://ru.dsplib.org/content/dft_freq/dft_freq.html">
перестановку спектральных отсчетов ДПФ
</a> и переносит нулевую частоту в центр вектора ДПФ. \n
Данная функция обрабатывает вещественные входные и выходные вектора
и может применяться для перестановки
амплитудного или фазового спектра.
\brief Perform a shift of the vector `x`, for use with the `fft` and `ifft`
functions, in order
<a href="http://en.dsplib.org/content/dft_freq/dft_freq.html">
to move the frequency 0 to the center
</a> of the vector `y`.
\param[in] x
Указатель на исходный вектор ДПФ. \n
Размер вектора `[n x 1]`. \n \n
Pointer to the input vector (FFT or IFFT result). \n
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер ДПФ \f$n\f$ (размер векторов до и после перестановки). \n \n
Input and output vector size. \n \n
\param[out] y
Указатель на вектор результата перестановки. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n \n
Pointer to the output vector with frequency 0 in the center. \n
Vector size is `[n x 1]`. \n
Memory must be allocated. \n \n
\return
`RES_OK` если перестановка произведена успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if function is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -2,65 +2,50 @@
/*! ****************************************************************************
\ingroup FILTER_ANALYSIS_GROUP
\fn int freqs(double* b, double* a, int ord, double* w, int n, complex_t *h)
\brief Analog filter frequency response \f$ H(j \omega) \f$ calculation
\brief Расчет комплексного коэффициента передачи
\f$ H(j \omega) \f$ аналогового фильтра.
Функция рассчитывает значения комплексного коэффициента передачи
\f$ H(j \omega)\f$ аналогового фильтра, заданного коэффициентами
передаточной функции \f$ H(s) \f$:
Function calculates analog filter frequaency response \f$ H(j \omega)\f$
corresponds to transfer function \f$ H(s) \f$:
\f[
H(s) = \frac {\sum_{k = 0}^{N} b_k s^k}
{\sum_{m = 0}^{N} a_m s^m},
\f]
где \f$ N \f$ - порядок фильтра (параметр `ord`).
Комплексный коэффициент передачи рассчитывается путем
подстановки \f$ s = j \omega \f$.
here \f$ N \f$ - filter order (equals to `ord`).
\param[in] b
Указатель на вектор коэффициентов числителя
передаточной функции \f$ H(s) \f$. \n
Размер вектора `[ord+1 x 1]`. \n \n
Pointer to the transfer function \f$ H(s) \f$
numerator coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n \n
\param[in] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$ H(s) \f$. \n
Размер вектора `[ord+1 x 1]`. \n \n
Pointer to the transfer function \f$ H(s) \f$
denominator coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n \n
\param[in] ord
Порядок фильтра. Количество коэффициентов числителя и
знаменателя передаточной функции \f$ H(s) \f$
равно `ord+1`. \n \n
Filter order. \n
Transfer function \f$ H(s) \f$ numerator and denominator
coefficients number equals `ord+1`. \n \n
\param[in] w
Указатель на вектор значений циклической частоты \f$ \omega \f$ (рад/с),
для которого будет рассчитан комплексный
коэффициент передачи \f$ H(j \omega) \f$. \n
Размер вектора `[n x 1]`. \n \n
Pointer to the angular frequency \f$ \omega \f$ (rad/s),
which used for frequency response \f$ H(j \omega) \f$ calculation. \n
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер вектора циклической частоты `w`. \n \n
The size of the angular frequency vector `w`. \n \n
\param[out] h
Указатель на вектор комплексного коэффициента передачи \f$ H(j \omega) \f$,
рассчитанного для циклической частоты `w`. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n \n
Pointer to the frequency response vector \f$ H(j \omega) \f$,
corresponds to angular frequency `w`. \n
Vector size is `[n x 1]`. \n
Memory must be allocated. \n \n
\return
`RES_OK` Комплексноый коэффициент передачи рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
\return `RES_OK` if frequency response vector is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -75,79 +60,74 @@ www.dsplib.org
int flag, double* mag, double* phi, double* tau)
\brief
Расчет амплитудно-частотной (АЧХ), фазочастотной характеристик (ФЧХ), а также
группового времени запаздывания (ГВЗ) цифрового или аналогового или фильтра.
Magnitude, phase response and group delay vectors calculation
for digital or analog filter corresponds to \f$H(s)\f$, or \f$H(z)\f$
transfer function.
Функция рассчитывает АЧХ, ФЧХ и ГВЗ аналогового или цифрового фильтра, заданного
передаточной характеристикой \f$H(s)\f$, или \f$H(z)\f$ соответственно
\param[in] b
Указатель на вектор коэффициентов числителя
передаточной функции \f$ H(s) \f$. \n
Размер вектора `[ord+1 x 1]`. \n \n
Pointer to the \f$ H(s) \f$ or \f$H(z)\f$ transfer function
numerator coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n \n
\param[in] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$ H(s) \f$. \n
Размер вектора `[ord+1 x 1]`. \n \n
Pointer to the \f$ H(s) \f$ or \f$H(z)\f$ transfer function
denominator coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n \n
\param[in] ord
Порядок фильтра. Количество коэффициентов
числителя и знаменателя передаточной
функции \f$ H(s) \f$ равно `ord+1`. \n \n
Filter order. \n
Transfer function \f$ H(s) \f$ or \f$H(z)\f$ numerator
and denominator coefficients number equals `ord+1`. \n \n
\param[in] w
Указатель на вектор значений циклической частоты \f$ \omega \f$ (рад/с),
для которого будет рассчитаны АЧХ, ФЧХ и ГВЗ аналогового фильтра,
если установлен флаг `DSPL_FLAG_ANALOG`. \n
В случае если флаг `DSPL_FLAG_ANALOG` не установлен, то вектор частоты `w`
используется как нормированная частота комплексного коэффициента передачи
\f$ H \left(\mathrm{e}^{j\omega} \right) \f$ цифрового фильтра. \n
В этом случае характеристика цифрового фильтра является
\f$ 2\pi \f$-периодической, и вектор частоты может содержать
произвольные значения, однако целесообразно задавать
его от 0 до \f$ \pi \f$, а такжет от 0 до \f$ 2\pi \f$, или
от \f$ -\pi \f$ до \f$ \pi \f$. \n
Размер вектора `[n x 1]`. \n \n
Pointer to the angular frequency \f$ \omega \f$ (rad/s),
which used for analog filter characteristics calculation
(flag sets as `DSPL_FLAG_ANALOG`). \n
For digital filter (flag sets as `DSPL_FLAG_DIGITAL`),
parameter `w` describes normalized frequency of
frequency response \f$ H \left(\mathrm{e}^{j\omega} \right) \f$.
Digital filter frequency response is \f$ 2\pi \f$-periodic function,
and vector `w` advisable to set from 0 to \f$ \pi \f$,
or from 0 to \f$ 2\pi \f$, or from \f$ -\pi \f$ to \f$ \pi \f$.
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер вектора циклической частоты `w`. \n \n
Size of frequency vector `w`. \n \n
\param[in] flag
Комбинация флагов, которые задают расчет параметров: \n
Binary flags to set calculation rules: \n
\verbatim
DSPL_FLAG_ANALOG Коэффициенты относятся к аналоговому фильтру
DSPL_FLAG_LOGMAG АЧХ рассчитывать в логарифмическом масштабе
DSPL_FLAG_UNWRAP раскрывать периодичность ФЧХ
DSPL_FLAG_ANALOG Coefficients corresponds to analog filter
DSPL_FLAG_DIGITAL Coefficients corresponds to digital filter
DSPL_FLAG_LOGMAG Calculate magnitude in logarithmic scale (in dB)
DSPL_FLAG_UNWRAP Unwrap radian phases by adding multiples of 2*pi
\endverbatim
\param[out] mag
Указатель на вектор АЧХ. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n
Если указатель `NULL`, то расчет АЧХ не производится. \n \n
Pointer to the filter magnitude vector. \n
Vector size is `[n x 1]`. \n
If pointer is `NULL`, then magnitude will not calculted. \n \n
\param[out] phi
Указатель на вектор ФЧХ. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n
Если указатель `NULL`, то расчет ФЧХ не производится. \n \n
Pointer to the phase response vector. \n
Vector size is `[n x 1]`. \n
If pointer is `NULL`, then phase response will not calculted. \n \n
\param[out] tau
Указатель на вектор ГВЗ. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n
Если указатель `NULL`, то расчет ГВЗ не производится. \n \n
Pointer to the group delay vector. \n
Vector size is `[n x 1]`. \n
If pointer is `NULL`, then group delay will not calculted. \n \n
\return
`RES_OK` Параметры фильтра рассчитаны успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
\return `RES_OK` if function is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции `filter_freq_resp`:
Example:
\include butter_ap_test.c
Результат работы программы:
Result:
\verbatim
b[ 0] = 1.002 a[ 0] = 1.002
@ -158,22 +138,19 @@ b[ 4] = 0.000 a[ 4] = 1.000
\endverbatim
\n
В каталоге `dat` будут созданы три файла: \n
In `dat` folder will be created 3 files: \n
\verbatim
butter_ap_test_mag.txt АЧХ фильтра
butter_ap_test_phi.txt ФЧХ фильтра
butter_ap_test_tau.txt ГВЗ фильтра
butter_ap_test_mag.txt magnitude
butter_ap_test_phi.txt phase response
butter_ap_test_tau.txt group delay
\endverbatim
Кроме того программа GNUPLOT произведет построение следующих графиков
по сохраненным в файлах данным:
In addition, GNUPLOT will build the following graphs from data stored in files:
\image html butter_ap_test.png
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -189,72 +166,56 @@ www.dsplib.org
\ingroup FILTER_ANALYSIS_GROUP
\fn int freqz(double* b, double* a, int ord, double* w, int n, complex_t *h)
\brief Расчет комплексного коэффициента передачи
\f$ H \left(e^{j \omega} \right)\f$ цифрового фильтра.
Функция рассчитывает значения комплексного коэффициента передачи
\f$ H \left(e^{j \omega} \right)\f$ цифрового фильтра, заданного
коэффициентами передаточной функции \f$H(z)\f$:
\brief Function calculates the digital filter frequency response
\f$ H \left(e^{j \omega} \right)\f$ corresponds to transfer function \f$H(z)\f$.
Digital filter transfer function:
\f[
H(z) = \frac {\sum_{k = 0}^{N} b_k z^{-k}}
{\sum_{m = 0}^{N} a_m z^{-m}},
H(z) = \frac{\sum\limits_{k = 0}^{N} b_k z^{-k}}
{\sum\limits_{m = 0}^{N} a_m z^{-m}},
\f]
here \f$N\f$ --- filter order (parameter `ord`). \n
где \f$N\f$ --- порядок фильтра (параметр `ord`). \n
Комплексный коэффициент передачи рассчитывается путем
подстановки \f$z = e^{j \omega} \f$. \n
Frequency response \f$ H \left(e^{j \omega} \right)\f$ we can get
if substitude \f$z = e^{j \omega} \f$. \n
\param[in] b
Указатель на вектор коэффициентов числителя
передаточной функции \f$H(z)\f$. \n
Размер вектора `[ord+1 x 1]`. \n \n
Pointer to the \f$ H(z) \f$ transfer function
numerator coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n \n
\param[in] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$H(z)\f$. \n
Размер вектора `[ord+1 x 1]`. \n \n
Pointer to the \f$H(z)\f$ transfer function
denominator coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n \n
\param[in] ord
Порядок фильтра. Количество коэффициентов числителя и знаменателя
передаточной функции \f$H(z)\f$ равно `ord+1`. \n \n
Filter order. \n
Transfer function \f$H(z)\f$ numerator
and denominator coefficients number equals `ord+1`. \n \n
\param[in] w
Указатель на вектор значений нормированной циклической частоты \f$\omega\f$,
для которого будет рассчитан комплексный коэффициент передачи
\f$ H \left(e^{j \omega} \right)\f$. \n
Размер вектора `[n x 1]`. \n \n
Pointer to the normalized frequency of digital filter
frequency response \f$ H \left(\mathrm{e}^{j\omega} \right) \f$. \n
Digital filter frequency response is \f$ 2\pi \f$-periodic function,
and vector `w` advisable to set from 0 to \f$ \pi \f$,
or from 0 to \f$ 2\pi \f$, or from \f$ -\pi \f$ to \f$ \pi \f$.
Vector size is `[n x 1]`. \n \n
\param[in] n
Размер вектора нормированной циклической частоты `w`. \n \n
Size of frequency vector `w`. \n \n
\param[out] h
Указатель на вектор комплексного коэффициента передачи
\f$ H \left(e^{j \omega} \right)\f$, рассчитанного для
циклической частоты `w`. \n
Размер вектора `[n x 1]`. \n
Память должна быть выделена. \n \n
Pointer to the frequency response vector
\f$ H \left(\mathrm{e}^{j\omega} \right) \f$,
corresponds to normalized frequency `w`. \n
Vector size is `[n x 1]`. \n
Memory must be allocated. \n \n
\return `RES_OK` if frequaency response vector is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\return
`RES_OK` Комплексный коэффициент передачи расcчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
\note
Комплексный коэффициент передачи \f$ H \left(e^{j \omega} \right)\f$
цифрового фильтра представляет собой \f$ 2 \pi-\f$периодическую функцию
нормированной циклической частоты \f$\omega\f$.
Поэтому анализ цифровых фильтров целесообразно вести на одном периоде
повторения \f$ H \left(e^{j \omega} \right)\f$, т.е. в интервале
\f$\omega\f$ от 0 до \f$2 \pi\f$, или от \f$-\pi\f$ до \f$ \pi\f$. \n
Кроме того известно, что для фильтра с вещественными коэффициентами
\f$ H \left(e^{j \omega} \right) = H^* \left(e^{-j \omega} \right)\f$,
а значит, анализ цифрового фильтра с вещественными коэффициентами
достаточно вести для нормированной частоты \f$\omega\f$ от 0 до \f$\pi\f$.
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -8,75 +8,72 @@
\fn int butter_ap(double Rp, int ord, double* b, double* a)
\brief
Расчет передаточной характеристики \f$ H(s) \f$ аналогового
нормированного ФНЧ Баттерворта.
Function calculates the transfer function \f$ H(s) \f$ coefficients of
analog normalized lowpass Butterworth filter.
Функция рассчитывает коэффициенты передаточной характеристики \f$H(s)\f$
аналогового нормированного ФНЧ Баттерворта порядка `ord` с частотой среза
1 рад/с по уровню \f$ -R_p \f$ дБ.
Analog normalized lowpass filter magnitude ripple equals \f$ -R_p \f$ dB
for angular frequency \f$ \omega \f$ from 0 to 1 rad/s.
\param[in] Rp
Неравномерность АЧХ в полосе пропускания (дБ). \n
Параметр задает уровень искажений в полосе от 0 до 1 рад/с. \n
Значение должно быть положительным. \n
Magnitude ripple in passband (dB). \n
This parameter sets maximum filter distortion from 0 to 1 rad/s frequency. \n
Parameter must be positive. \n
\n
\param[in] ord
Порядок фильтра. \n
Количество коэффициентов числителя и знаменателя
передаточной функции \f$H(s)\f$ равно `ord+1`. \n
Filter order. \n
Filter coefficients number equals `ord+1` for numerator and denominator
of transfer function \f$ H(s) \f$ \n
\n
\param[out] b
Указатель на вектор коэффициентов числителя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
numerator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[out] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
denominator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
Пример использования функции `butter_ap`:
Example:
\include butter_ap_test.c
Результат работы программы:
Result:
\verbatim
b[ 0] = 1.965 a[ 0] = 1.965
b[ 1] = 0.000 a[ 1] = 3.138
b[ 2] = 0.000 a[ 2] = 2.505
b[ 3] = 0.000 a[ 3] = 1.000
b[ 0] = 1.002 a[ 0] = 1.002
b[ 1] = 0.000 a[ 1] = 2.618
b[ 2] = 0.000 a[ 2] = 3.418
b[ 3] = 0.000 a[ 3] = 2.615
b[ 4] = 0.000 a[ 4] = 1.000
\endverbatim
\n
В каталоге `dat` будут созданы три файла: \n
In `dat` folder will be created 3 files: \n
\verbatim
butter_ap_test_mag.txt АЧХ фильтра
butter_ap_test_phi.txt ФЧХ фильтра
butter_ap_test_tau.txt ГВЗ фильтра
butter_ap_test_mag.txt magnitude
butter_ap_test_phi.txt phase response
butter_ap_test_tau.txt group delay
\endverbatim
Кроме того программа GNUPLOT произведет построение следующих графиков
по сохраненным в файлах данным:
In addition, GNUPLOT will build the following graphs from data stored in files:
\image html butter_ap_test.png
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -92,67 +89,58 @@ www.dsplib.org
complex_t* p, int* np)
\brief
Расчет массивов нулей и полюсов передаточной функции
\f$ H(s) \f$ аналогового нормированного ФНЧ Баттерворта.
Function calculates arrays of zeros and poles for analog normlized lowpass
Batterworth filter transfer function \f$ H(s) \f$ order `ord` .
Функция рассчитывает значения нулей и полюсов передаточной функции
\f$ H(s)\f$ аналогового нормированного ФНЧ Баттерворта порядка `ord`
с частотой среза 1 рад/с по уровню \f$-R_p\f$ дБ. \n
Analog normalized lowpass filter magnitude ripple equals \f$ -R_p \f$ dB
for angular frequency \f$ \omega \f$ from 0 to 1 rad/s.
\param[in] ord
Порядок фильтра. \n
Filter order. \n
Number of zeros and poles of filter can be less or equal `ord`. \n
\n
\param[in] rp
Неравномерность АЧХ в полосе пропускания (дБ). \n
Параметр задает уровень искажений в полосе от 0 до 1 рад/с. \n
Значение должно быть положительным. \n
Magnitude ripple in passband (dB). \n
This parameter sets maximum filter distortion from 0 to 1 rad/s frequency. \n
Parameter must be positive. \n
\n
\param[out] z
Указатель на массив комплексных нулей
передаточной характеристики \f$ H(s)\f$. \n
Максимальный размер вектора вектора `[ord x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$ H(s) \f$ zeros array. \n
Maximum vector size is `[ord x 1]`. \n
Memory must be allocated for maximum vector size. \n
\n
\param[out] nz
Указатель на переменную количества нулей
передаточной характеристики \f$ H(s)\f$. \n
По данному указателю будет записано количество
нулей фильтра, которые были рассчитаны и
помещены в вектор `z`. \n
Память должна быть выделена. \n
Pointer to the variable which keep number of finite zeros \f$ H(s) \f$. \n
Number of finite zeros which was calculated and saved in vector `z`. \n
Pointer cannot be `NULL`. \n
\n
\param[out] p
Указатель на массив комплексных полюсов
передаточной характеристики \f$ H(s)\f$. \n
Максимальный размер вектора вектора `[ord x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$ H(s) \f$ poles array. \n
Maximum vector size is `[ord x 1]`. \n
Memory must be allocated for maximum vector size. \n
\n
\param[out] np
Указатель на переменную количества полюсов
передаточной характеристики \f$ H(s)\f$. \n
По данному укащзателю будет записано количество нулей фильтра, которые
были рассчитны и помещены в вектор `p`. \n
Память должна быть выделена. \n
Pointer to the variable which keep number of
calculated poles of \f$ H(s) \f$. \n
Pointer cannot be `NULL`. \n
\n
\return
`RES_OK` --- массивы нулей и полюсов рассчитаны успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if zeros and poles is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
\note
Нормированный ФНЧ Баттерворта не имеет нулей, поэтому массив нулей `z`
не будет изменен, а по указателю `nz` будет записан 0. \n
Normalized Butterworth lowpass filter has no finite zeros.
So `z` vector will not changed and in pointer `nz` will write 0 value. \n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -167,51 +155,48 @@ www.dsplib.org
\fn int cheby1_ap(double Rp, int ord, double* b, double* a)
\brief
Расчет передаточной характеристики \f$ H(s) \f$ аналогового
нормированного ФНЧ Чебышёва первого рода.
Function calculates the transfer function \f$ H(s) \f$ coefficients of
analog normalized lowpass Chebyshev type 1 filter.
Функция рассчитывает коэффициенты передаточной характеристики
\f$ H(s)\f$ аналогового нормированного ФНЧ Чебышёва первого рода
порядка `ord` с частотой среза 1 рад/с по уровню \f$-R_p\f$ дБ. \n
Особенностью фильтра Чебышёва первого рода являются
равноволновые пульсации АЧХ в полосе пропускания.
Analog normalized lowpass filter magnitude ripple equals \f$ -R_p \f$ dB
for angular frequency \f$ \omega \f$ from 0 to 1 rad/s.
\param[in] Rp
Неравномерность АЧХ в полосе пропускания (дБ). \n
Параметр задает уровень искажений в полосе от 0 до 1 рад/с. \n
Значение должно быть положительным. \n
Magnitude ripple in passband (dB). \n
This parameter sets maximum filter distortion from 0 to 1 rad/s frequency. \n
Parameter must be positive. \n
\n
\param[in] ord
Порядок фильтра. \n
Количество коэффициентов числителя и знаменателя
передаточной функции \f$ H(s)\f$ равно `ord+1`. \n
Filter order. \n
Filter coefficients number equals `ord+1` for numerator and denominator
of transfer function \f$ H(s) \f$ \n
\n
\param[out] b
Указатель на вектор коэффициентов числителя передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
numerator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[out] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
denominator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
Пример использования функции `cheby1_ap`:
Example:
\include cheby1_ap_test.c
Результат работы программы:
Result:
\verbatim
b[ 0] = 0.125 a[ 0] = 0.177
@ -222,23 +207,19 @@ b[ 4] = 0.000 a[ 4] = 1.000
\endverbatim
\n
В каталоге `dat` будут созданы три файла: \n
In `dat` folder will be created 3 files: \n
\verbatim
cheby1_ap_test_mag.txt АЧХ фильтра
cheby1_ap_test_phi.txt ФЧХ фильтра
cheby1_ap_test_tau.txt ГВЗ фильтра
cheby1_ap_test_mag.txt magnitude
cheby1_ap_test_phi.txt phase response
cheby1_ap_test_tau.txt group delay
\endverbatim
\n
Кроме того программа GNUPLOT произведет построение следующих графиков
по сохраненным в файлах данным:
In addition, GNUPLOT will build the following graphs from data stored in files:
\image html cheby1_ap_test.png
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -253,64 +234,58 @@ www.dsplib.org
\fn int cheby1_ap_zp( int ord, double rp, complex_t *z, int* nz,
complex_t* p, int* np)
\brief
Расчет массивов нулей и полюсов передаточной функции \f$ H(s) \f$
аналогового нормированного ФНЧ Чебышёва первого рода.
Function calculates arrays of zeros and poles for analog normlized lowpass
Chebyshev type 1 filter transfer function \f$ H(s) \f$ order `ord` .
Analog normalized lowpass filter magnitude ripple equals \f$ -R_p \f$ dB
for angular frequency \f$ \omega \f$ from 0 to 1 rad/s.
Функция рассчитывает значения нулей и полюсов передаточной функции
\f$ H(s)\f$ аналогового нормированного ФНЧ Чебышёва первого рода
порядка `ord` с частотой среза 1 рад/с по уровню \f$-R_p\f$ дБ, с
неравномерностью в полосе пропускания \f$ R_p \f$ дБ. \n
\param[in] ord
Порядок фильтра. \n
Filter order. \n
Number of zeros and poles of filter can be less or equal `ord`. \n
\n
\param[in] rp
Неравномерность АЧХ в полосе пропускания (дБ). \n
Параметр задает уровень искажений в полосе от 0 до 1 рад/с. \n
Значение должно быть положительным. \n
Magnitude ripple in passband (dB). \n
This parameter sets maximum filter distortion from 0 to 1 rad/s frequency. \n
Parameter must be positive. \n
\n
\param[out] z
Указатель на массив комплексных нулей
передаточной характеристики \f$ H(s)\f$. \n
Максимальный размер вектора вектора `[ord x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$ H(s) \f$ zeros array. \n
Maximum vector size is `[ord x 1]`. \n
Memory must be allocated for maximum vector size. \n
\n
\param[out] nz
Указатель на переменную количества нулей
передаточной функции \f$H(s)\f$. \n
По данному указателю будет записано количество нулей фильтра,
которые были рассчитаны и помещены в вектор `z`. \n
Память должна быть выделена. \n
Pointer to the variable which keep number of finite zeros \f$ H(s) \f$. \n
Number of finite zeros which was calculated and saved in vector `z`. \n
Pointer cannot be `NULL`. \n
\n
\param[out] p
Указатель на массив комплексных полюсов
передаточной характеристики \f$H(s)\f$. \n
Максимальный размер вектора вектора `[ord x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$ H(s) \f$ poles array. \n
Maximum vector size is `[ord x 1]`. \n
Memory must be allocated for maximum vector size. \n
\n
\param[out] np
Указатель на переменную количества полюсов передаточной функции \f$ H(s)\f$. \n
По данному укащзателю будет записано количество нулей фильтра, которые были
рассчитны и помещены в вектор `p`. \n
Память должна быть выделена. \n
Pointer to the variable which keep number of
calculated poles of \f$ H(s) \f$. \n
Pointer cannot be `NULL`. \n
\n
\return
`RES_OK` --- массивы нулей и полюсов рассчитаны успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if zeros and poles is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
\note
Нормированный ФНЧ Чебышёва первого рода не имеет нулей, поэтому массив
нулей `z` не будет изменен, а по указателю `nz` будет записан 0. \n
Normalized Chebyshev type 1 lowpass filter has no finite zeros.
So `z` vector will not changed and in pointer `nz` will write 0 value. \n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -323,47 +298,50 @@ www.dsplib.org
\fn int cheby2_ap(double Rs, int ord, double *b, double *a)
\brief
Расчет передаточной характеристики \f$ H(s) \f$ аналогового
нормированного ФНЧ Чебышёва второго рода.
Function calculates the transfer function \f$ H(s) \f$ coefficients of
analog normalized lowpass Chebyshev type 2 filter.
Функция рассчитывает коэффициенты передаточной характеристики \f$H(s)\f$
аналогового нормированного ФНЧ Чебышёва второго рода порядка `ord`
с частотой заграждения 1 рад/с по уровню \f$-R_s\f$ дБ. \n
Особенностью фильтра Чебышёва второго рода являются: \n
1) равноволновые пульсации АЧХ в полосе заграждения. \n
2) уровень АЧХ \f$H(j\cdot 1) = -R_s\f$ дБ. \n
Analog normalized Chebyshev type 2 filter lowpass filter has \f$Rs\f$ dB
suppression in stopband.
Also analog normalized Chebyshev type 2 filter magnitude equals \f$-Rs\f$ dB
for angular frequency \f$\omega = 1\f$ rad/s.
\param[in] Rs
Уровень подавления в полосе пропускания (дБ). \n
Значение должно быть положительным. \n
Suppression level in stopband (dB). \n
This parameter sets filter supression for \f$\omega \geq 1\f$ rad/s frequency. \n
Parameter must be positive. \n
\n
\param[in] ord
Порядок фильтра. \n
Количество коэффициентов числителя и знаменателя
передаточной функции \f$H(s)\f$ равно `ord+1`. \n
Filter order. \n
Filter coefficients number equals `ord+1` for numerator and denominator
of transfer function \f$ H(s) \f$ \n
\n
\param[out] b
Указатель на вектор коэффициентов числителя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
numerator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[out] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
denominator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
Пример использования функции `cheby1_ap`:
\return
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
Example:
\include cheby2_ap_test.c
Результат работы программы:
Result:
\verbatim
b[ 0] = 0.008 a[ 0] = 0.008
@ -374,28 +352,19 @@ b[ 4] = 0.001 a[ 4] = 1.000
\endverbatim
\n
В каталоге `dat` будут созданы три файла: \n
In `dat` folder will be created 3 files: \n
\verbatim
cheby2_ap_test_mag.txt АЧХ фильтра
cheby2_ap_test_phi.txt ФЧХ фильтра
cheby2_ap_test_tau.txt ГВЗ фильтра
cheby2_ap_test_mag.txt magnitude
cheby2_ap_test_phi.txt phase response
cheby2_ap_test_tau.txt group delay
\endverbatim
\n
Кроме того программа GNUPLOT произведет построение следующих графиков
по сохраненным в файлах данным:
In addition, GNUPLOT will build the following graphs from data stored in files:
\image html cheby2_ap_test.png
\return
`RES_OK` --- фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -408,60 +377,60 @@ www.dsplib.org
complex_t* p, int* np)
\brief
Расчет массивов нулей и полюсов передаточной функции \f$ H(s) \f$
аналогового нормированного ФНЧ Чебышёва второго рода.
Function calculates arrays of zeros and poles for analog normlized lowpass
Chebyshev type 2 filter transfer function \f$ H(s) \f$ order `ord` .
Функция рассчитывает значения нулей и полюсов передаточной функции
\f$H(s)\f$ аналогового нормированного ФНЧ Чебышёва второго рода порядка `ord` с
частотой заграждения 1 рад/с по уровню \f$-R_s\f$ дБ. \n
Analog normalized Chebyshev type 2 filter lowpass filter has \f$Rs\f$ dB
suppression in stopband.
Also analog normalized Chebyshev type 2 filter magnitude equals \f$-Rs\f$ dB
for angular frequency \f$\omega = 1\f$ rad/s.
\param[in] ord
Порядок фильтра. \n
Filter order. \n
Number of zeros and poles of filter can be less or equal `ord`. \n
\n
\param[in] rs
Уровень подавления АЧХ в полосе загражения (дБ). \n
Параметр задает уровень подавления сигнала в полосе частот от 1 рад/с и выше. \n
Значение должно быть положительным. \n
Suppression level in stopband (dB). \n
This parameter sets filter supression for \f$\omega \geq 1\f$ rad/s frequency. \n
Parameter must be positive. \n
\n
\param[out] z
Указатель на массив комплексных нулей передаточной функции \f$H(s)\f$. \n
Максимальный размер вектора вектора `[ord x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$ H(s) \f$ zeros array. \n
Maximum vector size is `[ord x 1]`. \n
Memory must be allocated for maximum vector size. \n
\n
\param[out] nz
Указатель на переменную количества нулей передаточной функции \f$H(s)\f$. \n
По данному указателю будет записано количество нулей фильтра, которые были
рассчитаны и помещены в вектор `z`. \n
Память должна быть выделена. \n
Pointer to the variable which keep number of finite zeros \f$ H(s) \f$. \n
Number of finite zeros which was calculated and saved in vector `z`. \n
Pointer cannot be `NULL`. \n
\n
\param[out] p
Указатель на массив комплексных полюсов передаточной функции \f$H(s)\f$. \n
Максимальный размер вектора вектора `[ord x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$ H(s) \f$ poles array. \n
Maximum vector size is `[ord x 1]`. \n
Memory must be allocated for maximum vector size. \n
\n
\param[out] np
Указатель на переменную количества полюсов передаточной функции \f$H(s)\f$. \n
По данному указателю будет записано количество нулей
фильтра, которые были
рассчитаны и помещены в вектор `p`. \n
Память должна быть выделена. \n
Pointer to the variable which keep number of
calculated poles of \f$ H(s) \f$. \n
Pointer cannot be `NULL`. \n
\n
\return
`RES_OK` --- массивы нулей и полюсов рассчитаны успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if zeros and poles is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
Пример использования функции `cheby2_ap_zp`:
Example:
\include cheby2_ap_zp_test.c
Результат работы программы:
Result:
\verbatim
Chebyshev type 2 zeros:
@ -482,9 +451,7 @@ www.dsplib.org
p[ 6] = -0.852 -0.642 j
\endverbatim
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -496,52 +463,53 @@ www.dsplib.org
\fn int ellip_ap(double rp, double rs, int ord, double* b, double* a)
\brief
Расчет передаточной характеристики \f$ H(s) \f$ аналогового
нормированного эллиптического ФНЧ.
Функция рассчитывает коэффициенты передаточной характеристики \f$H(s)\f$
аналогового нормированного эллиптического ФНЧ порядка `ord`
с частотой среза 1 рад/с по уровню \f$-R_p\f$ дБ. \n
Особенностью эллиптического фильтра являются равноволновые пульсации
АЧХ как в полосе пропускания, так и в полосе заграждения, в результате
чего обеспечиваеся минимальная переходная полоса фильтра. \n
Function calculates the transfer function \f$ H(s) \f$ coefficients of
analog normalized lowpass elliptic filter order `ord` with passband ripple
`rp` dB and stopband suppression equals `rs` dB.
\param[in] rp
Уровень пульсаций в полосе пропускания (дБ). \n
Значение должно быть положительным. \n
Magnitude ripple in passband (dB). \n
This parameter sets maximum filter distortion from 0 to 1 rad/s frequency. \n
Parameter must be positive. \n
\n
\param[in] Rs
Уровень подавления в полосе заграждения (дБ). \n
Значение должно быть положительным. \n
\param[in] rs
Suppression level in stopband (dB). \n
This parameter sets filter supression for \f$\omega \geq 1\f$ rad/s frequency. \n
Parameter must be positive. \n
\n
\param[in] ord
Порядок фильтра. \n
Количество коэффициентов числителя и знаменателя
передаточной функции \f$H(s)\f$ равно `ord+1`. \n
Filter order. \n
Filter coefficients number equals `ord+1` for numerator and denominator
of transfer function \f$ H(s) \f$ \n
\n
\param[out] b
Указатель на вектор коэффициентов числителя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
numerator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[out] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
denominator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
Пример использования функции `ellip_ap`:
\return
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
Example:
\include ellip_ap_test.c
Результат работы программы:
Result:
\verbatim
b[ 0] = 0.268 a[ 0] = 0.301
@ -552,28 +520,19 @@ b[ 4] = 0.001 a[ 4] = 1.000
\endverbatim
\n
В каталоге `dat` будут созданы три файла: \n
In `dat` folder will be created 3 files: \n
\verbatim
ellip_ap_test_mag.txt АЧХ фильтра
ellip_ap_test_phi.txt ФЧХ фильтра
ellip_ap_test_tau.txt ГВЗ фильтра
ellip_ap_test_mag.txt magnitude
ellip_ap_test_phi.txt phase response
ellip_ap_test_tau.txt group delay
\endverbatim
\n
Кроме того программа GNUPLOT произведет построение следующих графиков
по сохраненным в файлах данным:
In addition, GNUPLOT will build the following graphs from data stored in files:
\image html ellip_ap_test.png
\return
`RES_OK` --- фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -589,67 +548,68 @@ www.dsplib.org
\ingroup IIR_FILTER_DESIGN_GROUP
\fn int filter_zp2ab(complex_t *z, int nz, complex_t *p, int np, int ord,
double* b, double* a)
\brief Функция пересчета нулей и полюсов аналогового фильтра в коэффициенты
передаточной характеристики \f$ H(s) \f$
\brief
Function recalculates complex zeros and poles of transfer function \f$ H(s) \f$
to the coefficients of \f$ H(s) \f$ numerator and denominator polynomials.
Transfer function can we described as:
\f[
H(s) =
\frac{\sum_{n = 0}^{N_z} b_n \cdot s^n}{\sum_{m = 0}^{N_p} a_m \cdot s^m} =
\frac{\prod_{n = 0}^{N_z}(s-z_n)}{\prod_{m = 0}^{N_p} (s-p_m)}
\frac{\sum\limits_{n = 0}^{N_z} b_n s^n}{\sum\limits_{m = 0}^{N_p} a_m s^m} =
\frac{\prod\limits_{n = 0}^{N_z}(s-z_n)}{\prod\limits_{m = 0}^{N_p} (s-p_m)}
\f]
\param[in] z
Указатель на массив нулей передаточной характеристики. \n
Размер вектора `[nz x 1]`. \n
Указатель может быть `NULL` если фильтр не имеет конечных нулей (`nz=0`). \n
Pointer to the vector of transfer function zeros. \n
Vector size is `[nz x 1]`. \n
Pointer can be `NULL` if filter has no finite zeros (`nz=0`). \n
\n
\param[in] nz
Размер вектора нулей передаточной характеристики (может быть равен 0). \n
Number of fitite zeros (can be zero). \n
\n
\param[in] p
Указатель на массив полюсов передаточной характеристики. \n
Размер вектора `[np x 1]`. \n
Указатель не может быть `NULL`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function poles. \n
Vector size is `[np x 1]`. \n
This pointer cannot be `NULL`. \n
\n
\param[in] np
Размер вектора полюсов передаточной характеристики (не может быть равен 0). \n
Size of vector of transfer function poles (`p` vector size). \n
\n
\param[in] ord
Порядок фильтра для которого рассчитаны нули и полюса. \n
Количество коэффициентов числителя и знаменателя
передаточной функции \f$H(s)\f$ равно `ord+1`. \n \n
Filter order. \n
Number of \f$H(s)\f$ numerator and denominator coefficients equals `ord+1`. \n
\n
\param[out] b
Указатель на вектор коэффициентов числителя передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
numerator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[out] a
Указатель на вектор коэффициентов знаменателя
передаточной функции \f$H(s)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of transfer function \f$H(s)\f$
denominator coefficient. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- пересчет произведен успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\n
\note
Функция возвращает вещественные значения коэффициентов `b` и `a`
передаточной функции. Это означает, что вектора нулей и полюсов
должны хранить вещественные значения или комплексно-сопряженные пары
нулей и полюсов, потому что мнимая часть коэффициентов `b` и `a`
игнорируется и не сохраняется.
Function calculates real `b` and `a` coefficients of \f$H(s)\f$.
It means that zeros and poles vectors must have real values or conjugate pairs
to get zeros image part of `b` and `a` coefficients. This function ignores
image part of `b` and `a` coeeffitients if the requirements for zeros
and poles are not fulfilled.
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -3,130 +3,121 @@
/*! ****************************************************************************
\ingroup FIR_FILTER_DESIGN_GROUP
\fn int DSPL_API fir_linphase(int ord, double w0, double w1, int filter_type,
int win_type, double win_param, double* h)
int win_type, double win_param, double* h)
\brief
Расчет коэффициентов линейно-фазового КИХ-фильтра
методом оконного взвешивания.
Function calculates linear-phase FIR filter coefficients by window method
Функция рассчитывает коэффициенты передаточной характеристики
FIR filter transfer function is
\f[
H(z) = \sum_{n = 0}^{ord} h_n z^{-n}
H(z) = \sum_{n = 0}^{ord} h_n z^{-n}.
\f]
цифрового линейно-фазового КИХ-фильтра фильтра.
\param[in] ord
Порядок фильтра (количество элементов задержки). \n
Количество коэффициентов фильтра равно `ord+1`. \n
Filter order. \n
Number of FIR filter coefficients is `ord+1`. \n
\n
\param[in] w0
Нормированная частота среза ФНЧ или ФВЧ,
или левая частота среза для полосового и режекторного фильтра. \n
Normalized cutoff frequency for lowpass and highpass filter,
or left cutoff frequency for bandpass or bandstop filter. \n
\n
\param[in] w1
Правая частота среза полосового и режекторного фильтра. \n
Данный параметр игнорируется для ФНЧ и ФВЧ. \n
Частота `w1` должна быть больше `w0`. \n
Right normalized cutoff frequency for bandpass or bandstop filter. \n
This parameter is ignored for lowpass or highpass filters. \n
Frequecny `w1` must be higher than `w0`. \n
\n
\param[in] filter_type
Тип фильтра. \n
Данный параметр определяет тип фильтра
и может принимать одно из значений: \n
Filter type. \n
This parameter can be one of follow: \n
\verbatim
DSPL_FILTER_LPF - фильтр нижних частот;
DSPL_FILTER_HPF - фильтр верхних частот;
DSPL_FILTER_BPASS - полосовой фильтр;
DSPL_FILTER_BSTOP - режекторный фильтр.
DSPL_FILTER_LPF - lowpass filter;
DSPL_FILTER_HPF - highpass filter;
DSPL_FILTER_BPASS - bandpass filter;
DSPL_FILTER_BSTOP - bandstop filter.
\endverbatim
\n
\n
\param [in] win_type
Тип оконной функции. \n
Может принимать одно из следующих значений: \n
Window function type. \n
This parameter can be one of follow: \n
\verbatim
-------------------------------------------------------------------------
Значение win_type | Описание
win_type | Description
-----------------------------|-------------------------------------------
DSPL_WIN_BARTLETT | Непараметрическое окно Бартлетта
DSPL_WIN_BARTLETT | Nonparametric Bartlett window
-----------------------------|-------------------------------------------
DSPL_WIN_BARTLETT_HANN | Непараметрическое окно Бартлетта-Ханна
DSPL_WIN_BARTLETT_HANN | Nonparametric Bartlett-Hann window
-----------------------------|-------------------------------------------
DSPL_WIN_BLACKMAN | Непараметрическое окно Блэкмана
DSPL_WIN_BLACKMAN | Nonparametric Blackman window
-----------------------------|-------------------------------------------
DSPL_WIN_BLACKMAN_HARRIS | Непараметрическое окно Блэкмана-Харриса
DSPL_WIN_BLACKMAN_HARRIS | Nonparametric Blackman-Harris window
-----------------------------|-------------------------------------------
DSPL_WIN_BLACKMAN_NUTTALL | Непараметрическое окно Блэкмана-Натталла
DSPL_WIN_BLACKMAN_NUTTALL | Nonparametric Blackman-Nuttall
-----------------------------|-------------------------------------------
DSPL_WIN_CHEBY | Параметрическое окно Дольф-Чебышева.
| Параметр win_param задает уровень
| боковых лепестков в дБ.
DSPL_WIN_CHEBY | Parametric Dolph-Chebyshev window.
| Parametr `win_param` sets sidelobe attenuation
| level in dB.
-----------------------------|-------------------------------------------
DSPL_WIN_COS | Непараметрическое косинус-окно
DSPL_WIN_COS | Nonparametric Cosine window
-----------------------------|-------------------------------------------
DSPL_WIN_FLAT_TOP | Непараметрическое окно с максимально
| плоской вершиной
DSPL_WIN_FLAT_TOP | Nonparametric maxflat window
-----------------------------|-------------------------------------------
DSPL_WIN_GAUSSIAN | Параметрическое окно Гаусса
DSPL_WIN_GAUSSIAN | Nonparametric Gauss window
-----------------------------|-------------------------------------------
DSPL_WIN_HAMMING | Непараметрическое окно Хемминга
DSPL_WIN_HAMMING | Nonparametric Hamming window
-----------------------------|-------------------------------------------
DSPL_WIN_HANN | Непараметрическое окно Ханна
DSPL_WIN_HANN | Nonparametric Hann window
-----------------------------|-------------------------------------------
DSPL_WIN_KAISER | Параметрическое окно Кайзера
DSPL_WIN_KAISER | Parametric Kaiser window
-----------------------------|-------------------------------------------
DSPL_WIN_LANCZOS | Непараметрическое окно Ланкзоса
DSPL_WIN_LANCZOS | Nonparametric Lanczos window
-----------------------------|-------------------------------------------
DSPL_WIN_NUTTALL | Непараметрическое окно Натталла
DSPL_WIN_NUTTALL | Nonparametric Nuttall window
-----------------------------|-------------------------------------------
DSPL_WIN_RECT | Непараметрическое прямоугольное окно
DSPL_WIN_RECT | Nonparametric rectangular window
-------------------------------------------------------------------------
\endverbatim
\n
\n
\param [in] win_param
Параметр окна. \n
Данный параметр применяется только для параметрических оконных функций. \n
Для непараметрических окон игнорируется. \n
Parameter value for parametric windows. \n
This parameter is used for parametric windows only and is ignored for
nonparametric windows. \n
\n
\param[out] h
Указатель на вектор коэффициентов линейно-фазового КИХ-фильтраю \f$H(z)\f$. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the linear-phase FIR filter coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n
Memoru must be allocated. \n
\n
\note
Для соблюдения условия линейной ФЧХ используются
только симметричные окна. \n \n
Расчет режекторного линейно-фазового КИХ-фильтра
(если `filter_type = DSPL_FILTER_BSTOP`) производится только
для фильтров чётного порядка `ord`.
В случае нечетного порядка `ord` функция вернет код ошибки `ERROR_FILTER_ORD`.
Only symmetric windows can achieve linear-phase FIR filter. \n \n
Bandstop filter type (`filter_type = DSPL_FILTER_BSTOP`) requires
only even filter order `ord`.
If `filter_type = DSPL_FILTER_BSTOP` and `ord` is odd then function
returns `ERROR_FILTER_ORD` code.
\n
\return
`RES_OK`
Фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции:
Example:
\include fir_linphase_test.c
Программа расчитывает коэффициенты и АЧХ линейно-фазовых КИХ-фильтрова нижних,
верхних частот, полосовых и режекторных с применением различных весовых окон:
прямоугольное, Хемминга, Илэкмана и Блэкмана-Харриса. \n
Полученные АЧХ выводятся на график
This function calculates coeffictiens of lowpass, highpass, bandpass
and bandstop linear-phase FIR filters by using different kind of windows.
Also program calculates filter magnitudes and plots. \n
\image html fir_linphase_test.png
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -2,62 +2,57 @@
\ingroup IIR_FILTER_DESIGN_GROUP
\fn int low2high (double* b, double* a, int ord, double w0, double w1,
double* beta, double* alpha)
\brief Частотное преобразование ФНЧ-ФВЧ
\brief Lowpass to highpass filter frequency transform
Функция производит перобразование передаточной функции \f$ H(s) \f$
аналогового ФНЧ с частотой среза `w0` рад/c
в передаточную функцию \f$ F(s) \f$ аналоговго ФВЧ с частотой среза `w1` рад/c.
Function transforms lowpass filter transfer function \f$ H(s) \f$
to the highpass filter transfer function \f$ F(s) \f$.
Неравномерность АЧХ в полосе пропускания, уровень подавления в полосе
заграждения и порядок фильтра остаются неизменными.
Filter order, magnitude ripple in passband and stopband
supression still the same.
\param[in] b
Указатель на вектор коэффициентов числителя передаточной функции \f$H(s)\f$
исходного аналогового ФНЧ. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the lowpass filter transfer function \f$H(s)\f$ numerator
coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n
\n
\param[in] a
Указатель на вектор коэффициентов знаменателя передаточной функции \f$H(s)\f$
исходного аналогового ФНЧ. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the lowpass filter transfer function \f$H(s)\f$ denominator
coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n
\n
\param[in] ord
Порядок исходного фильтра и фильтра после переобразования. \n
Filter order. \n
\n
\param[in] w0
Частота среза исходного ФНЧ. \n
Lowpass filter cutoff frequency. \n
\n
\param[in] w1
Требуемая частота среза ФВЧ после преобразования. \n
Highpass filter cutoff frequency after transformation. \n
\n
\param[in,out] beta
Указатель на вектор коэффициентов числителя передаточной функции \f$F(s)\f$
ФВЧ после преобразования. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the highwpass filter transfer function \f$F(s)\f$ numerator
coefficients vector after transformation. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[in,out] alpha
Указатель на вектор коэффициентов знаменателя передаточной функции \f$F(s)\f$
аналогового ФВЧ после преобразования. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the highwpass filter transfer function \f$F(s)\f$ denominator
coefficients vector after transformation. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- преобразование рассчитано успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -70,61 +65,59 @@ www.dsplib.org
\ingroup IIR_FILTER_DESIGN_GROUP
\fn int low2low(double* b, double* a, int ord, double w0, double w1,
double* beta, double* alpha)
\brief Частотное преобразование ФНЧ-ФНЧ
Функция производит преобразование передаточной функции \f$ H(s) \f$
аналогового ФНЧ с частотой среза `w0` рад/c
в передаточную функцию \f$ F(s) \f$ аналоговго ФНЧ с частотой среза `w1` рад/c.
Lowpass to lowpass filter frequency transform
Неравномерность АЧХ в полосе пропускания, уровень подавления в полосе
заграждения и порядок фильтра остаются неизменными.
Function transforms lowpass filter transfer function \f$ H(s) \f$
to the lowpass filter transfer function \f$ F(s) \f$
with other cutoff frequency.
Filter order, magnitude ripple in passband and stopband
supression still the same.
\param[in] b
Указатель на вектор коэффициентов числителя передаточной функции \f$H(s)\f$
исходного аналогового ФНЧ. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the input lowpass filter transfer function \f$H(s)\f$ numerator
coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n
\n
\param[in] a
Указатель на вектор коэффициентов знаменателя передаточной функции \f$H(s)\f$
исходного аналогового ФНЧ. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the input lowpass filter transfer function \f$H(s)\f$ denominator
coefficients vector. \n
Vector size is `[ord+1 x 1]`. \n
\n
\param[in] ord
Порядок исходного фильтра и фильтра после преобразования. \n
Filter order. \n
\n
\param[in] w0
Частота среза исходного ФНЧ. \n
Input lowpass filter cutoff frequency. \n
\n
\param[in] w1
Требуемая частота среза ФНЧ после преобразования. \n
Lowpass filter cutoff frequency after transformation. \n
\n
\param[in,out] beta Указатель на вектор коэффициентов числителя
передаточной функции \f$F(s)\f$ ФНЧ после преобразования. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
\param[in,out] beta
Pointer to the lowpass filter transfer function \f$F(s)\f$ numerator
coefficients vector after transformation. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[in,out] alpha
Указатель на вектор коэффициентов знаменателя передаточной функции \f$F(s)\f$
аналогового ФНЧ после преобразования. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the lowpass filter transfer function \f$F(s)\f$ denominator
coefficients vector after transformation. \n
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- Преоборазование расчитано успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter coefficients is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -140,9 +133,9 @@ www.dsplib.org
\fn int ratcompos( double* b, double* a, int n,
double* c, double* d, int p,
double* beta, double* alpha)
\brief Рациональная композиця
\brief Rational composition
Функция рассчитывает композицию вида \f$Y(s) = (H \circ F)(s) = H(F(s))\f$, где
Function calcultes composition \f$Y(s) = (H \circ F)(s) = H(F(s))\f$, here
\f[
H(s) = \frac{\sum\limits_{m = 0}^{n} b_m s^m}
@ -153,65 +146,59 @@ Y(s) = \frac{\sum\limits_{m = 0}^{n p} \beta_m s^m}
{\sum\limits_{k = 0}^{n p} \alpha_k s^k}
\f]
Функция рациональной композиции необходима для произведения частотных
преобразований передаточных характеристик аналоговых и цифровых фильтров,
а также для билинейного преобразования передаточных характеристик аналоговых
фильтров в соответствующие передаточные характеристики цифровых фильтров.
This function is using for filter frequency transform.
\param[in] b
Указатель на вектор коэффициентов числителя функции \f$H(s)\f$. \n
Размер вектора `[n+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$H(s)\f$ polynomial function
numerator coefficients vector. \n
Vector size is `[n+1 x 1]`. \n
\n
\param[in] a
Указатель на вектор коэффициентов знаменателя функции \f$H(s)\f$. \n
Размер вектора `[n+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$H(s)\f$ polynomial function
denominator coefficients vector. \n
Vector size is `[n+1 x 1]`. \n
\n
\param[in] n
Порядок полиномов рациональной функции \f$H(s)\f$. \n
Order of \f$H(s)\f$ numerator and denominator polynomials. \n
\n
\param[in] c
Указатель на вектор коэффициентов числителя функции \f$F(s)\f$. \n
Размер вектора `[p+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$F(s)\f$ polynomial function
numerator coefficients vector. \n
Vector size is `[p+1 x 1]`. \n
\n
\param[in] d
Указатель на вектор коэффициентов знаменателя функции \f$F(s)\f$. \n
Размер вектора `[p+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the \f$F(s)\f$ polynomial function
denominator coefficients vector. \n
Vector size is `[p+1 x 1]`. \n
\n
\param[in] p
Порядок полиномов рациональной
функции \f$F(s)\f$. \n
Order of \f$F(s)\f$ numerator and denominator polynomials. \n
\n
\param[in,out] beta
Указатель на вектор коэффициентов
числителя функции \f$Y(s) = (H \circ F)(s)\f$. \n
Размер вектора `[n*p+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the numerator coefficients vector of
\f$Y(s) = (H \circ F)(s)\f$. \n
Vector size is `[n*p+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[in,out] alpha
Указатель на вектор коэффициентов знаменателя
функции \f$Y(s) = (H \circ F)(s)\f$. \n
Размер вектора `[n*p+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the denominator coefficients vector of
\f$Y(s) = (H \circ F)(s)\f$. \n
Vector size is `[n*p+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- Рациональная композиция рассчитана успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if rational composition is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -5,74 +5,71 @@
\fn int bilinear(double* bs, double* as, int ord, double* bz, double* az)
\brief
Билинейное преобразование передаточной характеристики аналогового
фильтра \f$H(s)\f$, в передаточную характеристику цифрового фильтра \f$H(z)\f$.
Transform a s-plane analog filter transfer function \f$H(s)\f$ to the
digital filter transfer function \f$H(z)\f$.
Функция рассчитывает коэффициенты передаточной характеристики \f$H(z)\f$
цифрового фильтра путем дробно-рациональной подстановки вида
Bilinear transform is rational composition:
\f[
s \leftarrow \frac{1 - z^{-1}}{1 - z^{-1}}.
\f]
Порядок цифрового фильтра при этом остается равным порядку аналогового фильтра,
а ось частот \f$\Omega\f$ аналогового фильтра связана c осью частот
\f$\omega\f$ цифрового фильтра соотношением:
Digital filter order, passband magnitude ripple and stopband suppression
still the same after bilinear transform as analog filter.
Frequency \f$\Omega\f$ of analog filter and frequency
\f$\omega\f$ of digital filter relations:
\f[
\Omega = \tan(\omega / 2).
\f]
\param[in] bs
Указатель на вектор коэффициентов числителя передаточной функции \f$H(s)\f$
исходного аналогового фильтра. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of analog filter \f$H(s)\f$
numerator coefficients.
Vector size is `[ord+1 x 1]`. \n
\n
\param[in] as
Указатель на вектор коэффициентов знаменателя передаточной функции \f$H(s)\f$
исходного аналогового фильтра. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of analog filter \f$H(s)\f$
denominator coefficients vector.
Vector size is `[ord+1 x 1]`. \n
\n
\param[in] ord
Порядок фильтра. \n
Количество коэффициентов числителя и знаменателя передаточных функций
\f$H(s)\f$ и \f$H(z)\f$ аналогового и цифрового фильтров равно `ord+1`. \n
Analog and digital filters order. \n
\n
\param[out] bz
Указатель на вектор коэффициентов числителя передаточной функции \f$H(z)\f$
полученного цифрового фильтра. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of digital filter \f$H(z)\f$
numerator coefficients after bilinear transform.
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\param[out] az
Указатель на вектор коэффициентов знаменателя передаточной функции \f$H(z)\f$
полученного цифрового фильтра. \n
Размер вектора `[ord+1 x 1]`. \n
Память должна быть выделена. \n
Pointer to the vector of digital filter \f$H(z)\f$
denominator coefficients after bilinear transform.
Vector size is `[ord+1 x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if bilinear transform is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции `bilinear`:
Example:
\include bilinear_test.c
Данная программа производит расчет передаточной характеристики аналогового
фильтра Чебышева первого рода, с частотой среза равной 1 рад/с, и производит
билинейное преобразование в цифровой, с частотой среза равной 0.5.
This program calculates the transfer function \f$H(s)\f$ of analog
Chebyshev filter of the first kind, with a cutoff frequency of 1 rad/s,
and produces bilinear trandform to digital filter,
with a normilized cutoff frequency equals 0.5.
Результат работы программы:
Result:
\verbatim
bz[0] = 0.246 az[0] = 4.425
@ -83,14 +80,12 @@ bz[4] = 0.246 az[4] = 1.034
err = 0
\endverbatim
Кроме этого производится расчет АЧХ полученного цифрового фильтра и строится
график АЧХ пакетом GNUPLOT
In addition, the frequency response of the resulting digital filter
is calculated and plotted by GNUPLOT package.
\image html bilinear.png
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -104,91 +99,86 @@ www.dsplib.org
\fn int iir(double rp, double rs, int ord, double w0, double w1,
int type, double* b, double* a)
\brief
Функция расчета коэффициентов передаточной характеристики \f$H(z)\f$
цифрового фильтра БИХ.
Digital IIR filter design.
Функция рассчитывает коэффициенты передаточной характеристики \f$H(z)\f$
цифрового фильтра, которые могут быть использованы в функции \ref filter_iir
The function calculates the coefficients of the digital IIR filter
transfer fucntion \f$ H(z) \f$.
Filter coeffitients can be used in \ref filter_iir function
\param[in] rp
Уровень неравномерности квадрата АЧХ в полосе пропускания фильтра (дБ). \n
Размер вектора `[ord+1 x 1]`. \n
Magnitude ripple in passband (dB). \n
\n
\param[in] rs
Уровень подавления в полосе заграждения фильтра (дБ).\n
Suppression level in stopband (dB). \n
\n
\param[in] ord
Порядок фильтра. \n
Количество коэффициентов числителя и знаменателя передаточной
функции \f$H(z)\f$ цифрового фильтров равно `ord+1`. \n
Для полосовых и режекторных фильтров параметр `ord` должен быть чётным. \n
Filter order. \n
Number of \f$H(z)\f$ numerator and denominator coefficients is `ord+1`. \n
For bandpass and bandstop filters `ord` must be even. \n
\n
\param[in] w0
Нормированная частота среза ФНЧ или ФВЧ, или левая частота среза для
полосового и режекторного фильтра.\n
Normalized cutoff frequency (from 0 to 1) for lowpass or highpass filter. \n
Or left normalized cutoff frequency (from 0 to 1) for
bandpass and bandstop filter. \n
\n
\param[in] w1
Правая частота среза полосового и режекторного фильтра. \n
Данный параметр игнорируется для ФНЧ и ФВЧ. \n
Right normalized cutoff frequency (from 0 to 1) for
bandpass and bandstop filter. \n
This parameter is ingnored for lowpass and highpass filters.
\n
\param[in] type
Тип фильтра. \n
Данный параметр определяет тип фильтра и образуется
набором флагов типа фильтра: \n
Filter type. \n
This patameter sets combination of filter type (one of follow): \n
\verbatim
DSPL_FILTER_LPF - фильтр нижних частот;
DSPL_FILTER_HPF - фильтр верхних частот;
DSPL_FILTER_BPASS - полосовой фильтр;
DSPL_FILTER_BSTOP - режекторный фильтр,
DSPL_FILTER_LPF - lowpass filter;
DSPL_FILTER_HPF - highpass filter;
DSPL_FILTER_BPASS - bandpass filter;
DSPL_FILTER_BSTOP - bandstop filter,
\endverbatim
а также флагов типа аппроксимации АЧХ фильтра:
and of filter approximation type (one of follow):
\verbatim
DSPL_FILTER_BUTTER - фильтр Баттерворта;
DSPL_FILTER_CHEBY1 - фильтр Чебышева первого рода;
DSPL_FILTER_CHEBY2 - фильтр Чебышева второго рода;
DSPL_FILTER_ELLIP - эллиптический фильтр.
DSPL_FILTER_BUTTER - Butterworth filter;
DSPL_FILTER_CHEBY1 - Chebyshev of the first kind filter;
DSPL_FILTER_CHEBY2 - Chebyshev of the second kind filter;
DSPL_FILTER_ELLIP - Elliptic filter.
\endverbatim
\n
\n
\param[out] b
Указатель на вектор коэффициентов
числителя передаточной функции \f$H(z)\f$. \n
Размер вектора `ord+1`. \n
Память должна быть выделена. \n
Pointer to the transfer function \f$H(z)\f$
numerator coefficients vector. \n
Vector size is `ord+1`. \n
Memory must be allocated. \n
\n
\param[out] a
Указатель на вектор коэффициентов знаменателя передаточной
функции \f$H(z)\f$. \n
Размер вектора `ord+1`. \n
Память должна быть выделена. \n
Pointer to the transfer function \f$H(z)\f$
denominator coefficients vector. \n
Vector size is `ord+1`. \n
\n
\return
`RES_OK` --- Фильтр рассчитан успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if filter is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
Пример использования функции:
Example:
\include iir_test.c
Данная программа производит расчет коэффициентов фильтров
при различном сочетании флагов параметра `type`.
This program calcultes filter coefficients for different flags `type`.
Кроме этого производится расчет АЧХ полученных цифровых фильтров и выводится на
график АЧХ пакетом GNUPLOT
In addition, the filters magnitudes
is calculated and plotted by GNUPLOT package.
\image html iir_test.png
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -4,64 +4,55 @@
int nw, double* w, complex_t* y)
\brief
Расчет коэффициентов разложения в ряд Фурье
Функция рассчитывает спектр периодического сигнала при усечении ряда Фурье \n
Fourier series coefficient calculation for periodic signal
\param[in] t
Указатель на массив моментов времени дискретизации исходного сигнала `s`. \n
Размер вектора вектора `[nt x 1]`. \n
Память должна быть выделена. \n
Pointer to the time vector. \n
Vector size is `[nt x 1]`. \n
\n
\param[in] s
Указатель на массив значений исходного сигнала`s`. \n
Размер вектора `[nt x 1]`. \n
Память должна быть выделена. \n
Pointer to the signal corresponds to time `t`. \n
Vector size is `[nt x 1]`. \n
\n
\param[in] nt
Размер выборки исходного сигнала. \n
Значение должно быть положительным. \n
Size of time and signal vectors. \n
This value must be positive. \n
\n
\param[in] period
Период повторения сигнала. \n
Signal time period. \n
\n
\param[in] nw
Размер усеченного ряда Фурье. \n
Number of Fourie series coefficients. \n
\n
\param[out] w
Указатель на массив частот спектра периодического сигнала. \n
Размер вектора `[nw x 1]`. \n
Память должна быть выделена. \n
Pointer to the frequency vector (rad/s). \n
Vector size is `[nw x 1]`. \n
Memory must be allocated. \n
\n
\param[out] y
Указатель массив комплексных значений спектра периодического сигнала. \n
Размер вектора `[nw x 1]`. \n
Память должна быть выделена. \n
Pointer to the complex Fourier series coefficients vector. \n
Vector size is `[nw x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- коэффициенты ряда Фурье рассчитаны успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if function is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\note
Для расчета спектра сигнала используется численное интегрирование
исходного сигнала методом трапеций. Данная функция не является
эффективной. Для увеличения скорости расчета спектра сигнала
целесообразнее использовать алгоритмы дискретного
и быстрого преобразования Фурье.
Numerical integration is used for Fourier series coefficients calculation.
This function is not effective.
To increase the speed of calculation of the signal spectrum
it is more expedient to use fast Fourier transform algorithms.
\n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */
@ -73,61 +64,56 @@ www.dsplib.org
\ingroup DFT_GROUP
\fn int fourier_series_rec(double* w, complex_t* s, int nw,
double* t, int nt, complex_t* y)
\brief Восстановление сигнала при усечении ряда Фурье
\brief Time signal reconstruction from Fourier series coefficients.
Функция рассчитывает восстановленный сигнал при усечении ряда Фурье:
Function reconstructs the time signal:
\f[
s(t) = \sum\limits_{n = 0}^{n_{\omega}-1} S(\omega_n) \exp(j\omega_n t)
\f]
\param[in] w
Указатель на массив частот \f$\omega_n\f$ усеченного ряда Фурье. \n
Размер вектора `[nw x 1]`. \n
Память должна быть выделена и заполнена. \n
Pointer to the Fourier series spectrum frequency vector \f$\omega_n\f$. \n
Vector size is `[nw x 1]`. \n
\n
\param[in] s
Указатель на массив значений спектра \f$S(\omega_n)\f$. \n
Размер вектора `[nw x 1]`. \n
Память должна быть выделена и заполнена. \n
Pointer to the Fourier series coefficients vector \f$S(\omega_n)\f$. \n
Vector size is `[nw x 1]`. \n
\n
\param[in] nw
Количество членов усеченного ряда Фурье. \n
Значение должно быть положительным. \n
Number of Fourier series coefficients. \n
This value must be positive. \n
\n
\param[in] t Указатель на массив временных отсчетов
восстановленного сигнала. \n
Размер вектора `[nt x 1]`. \n
Память должна быть выделена и заполнена. \n
\param[in] t
Pointer to the reconstructed signal time vector. \n
Vector size is `[nt x 1]`. \n
\n
\param[in] nt
Размер вектора времени и восстановленного сигнала. \n
Size of time vector and reconstructed signal vector . \n
\n
\param[out] y
Указатель на массив восстановленного сигнала. \n
Размер вектора `[nt x 1]`. \n
Память должна быть выделена. \n
Pointer to the reconstructed signal vector. \n
Vector size is `[nt x 1]`. \n
Memory must be allocated. \n
\n
\return
`RES_OK` --- восстановление сигнала прошло успешно. \n
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
`RES_OK` if function is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
\note
Выходной восстановленный сигнал в общем случае является комплексным.
Однако при соблюдении свойств симметрии векторов `w` и `s` относительно
нулевой частоты получим мнимую часть элементов вектора `y` на уровне ошибок
округления числа с двойной точностью. Ничтожно малую мнимую часть в этом случае
можно игнорировать.
The output reconstructed signal is generally complex.
However, subject to the symmetry properties of the vectors `w` and` s`
with respect to zero frequency we get the imaginary part of the vector `y`
at the EPS level. The negligible imaginary part in this case
can be ignored.
\n
\author
Бахурин Сергей
www.dsplib.org
\author Sergey Bakhurin www.dsplib.org
***************************************************************************** */

Wyświetl plik

@ -57,11 +57,16 @@ void dft5 (complex_t *x, complex_t* y);
#define DFT7_W8 -0.874842290961656665615465
void dft7 (complex_t *x, complex_t* y);
#define DFT8_W 0.707106781186548
void dft8 (complex_t *x, complex_t* y);
void transpose2x4(complex_t *x, complex_t* y);
void transpose4x2(complex_t *x, complex_t* y);
#define DFT16_W1 0.923879532511287
#define DFT16_W2 0.382683432365090
#define DFT16_W3 0.707106781186548
void dft16 (complex_t *x, complex_t* y);
void transpose4x4(complex_t *x, complex_t* y);

Wyświetl plik

@ -122,6 +122,7 @@ int fft_krn(complex_t* t0, complex_t* t1, fft_t* p, int n, int addr)
n1 = 1;
if(n%16== 0) { n1 = 16; goto label_size; }
if(n%7 == 0) { n1 = 7; goto label_size; }
if(n%8 == 0) { n1 = 8; goto label_size; }
if(n%5 == 0) { n1 = 5; goto label_size; }
if(n%4 == 0) { n1 = 4; goto label_size; }
if(n%3 == 0) { n1 = 3; goto label_size; }
@ -159,7 +160,11 @@ label_size:
if(n1 == 7)
for(k = 0; k < n2; k++)
dft7(t0+7*k, t1+7*k);
dft7(t0+7*k, t1+7*k);
if(n1 == 8)
for(k = 0; k < n2; k++)
dft8(t0+8*k, t1+8*k);
if(n1 == 5)
for(k = 0; k < n2; k++)
@ -221,6 +226,7 @@ int DSPL_API fft_create(fft_t* pfft, int n)
n2 = 1;
if(s%16== 0) { n2 = 16; goto label_size; }
if(s%7 == 0) { n2 = 7; goto label_size; }
if(s%8 == 0) { n2 = 8; goto label_size; }
if(s%5 == 0) { n2 = 5; goto label_size; }
if(s%4 == 0) { n2 = 4; goto label_size; }
if(s%3 == 0) { n2 = 3; goto label_size; }

Wyświetl plik

@ -173,6 +173,10 @@ void dft5 (complex_t *x, complex_t* y)
}
/*******************************************************************************
7 points DFT (Winograd algorithm)
*******************************************************************************/
void dft7 (complex_t *x, complex_t* y)
{
complex_t sum[31];
@ -193,6 +197,7 @@ void dft7 (complex_t *x, complex_t* y)
/* Winograd paper mistake?! */
RE(sum[5]) = RE(x[2]) + RE(x[5]);
IM(sum[5]) = IM(x[2]) + IM(x[5]);
/* Winograd paper mistake?! */
RE(sum[6]) = RE(x[2]) - RE(x[5]);
IM(sum[6]) = IM(x[2]) - IM(x[5]);
@ -314,6 +319,60 @@ void dft7 (complex_t *x, complex_t* y)
}
/*******************************************************************************
8 points DFT
*******************************************************************************/
void dft8 (complex_t *x, complex_t* y)
{
complex_t t0[8];
complex_t t1[8];
double tmp;
transpose2x4(x, t0);
dft4(t0, t1);
dft4(t0+4, t1+4);
/* 0.707106781186548 - 707106781186548i */
tmp = (RE(t1[5]) + IM(t1[5])) * DFT8_W;
IM(t1[5]) = (IM(t1[5]) - RE(t1[5])) * DFT8_W;
RE(t1[5]) = tmp;
/* 0.000000000000000 - 1.000000000000000i */
tmp = RE(t1[6]);
RE(t1[6]) = IM(t1[6]);
IM(t1[6]) = -tmp;
/* -0.707106781186548 - 707106781186548i */
tmp = (IM(t1[7]) - RE(t1[7])) * DFT8_W;
IM(t1[7]) = -(IM(t1[7]) + RE(t1[7])) * DFT8_W;
RE(t1[7]) = tmp;
transpose4x2(t1, t0);
RE(t1[0]) = RE(t0[0]) + RE(t0[1]);
IM(t1[0]) = IM(t0[0]) + IM(t0[1]);
RE(t1[1]) = RE(t0[0]) - RE(t0[1]);
IM(t1[1]) = IM(t0[0]) - IM(t0[1]);
RE(t1[2]) = RE(t0[2]) + RE(t0[3]);
IM(t1[2]) = IM(t0[2]) + IM(t0[3]);
RE(t1[3]) = RE(t0[2]) - RE(t0[3]);
IM(t1[3]) = IM(t0[2]) - IM(t0[3]);
RE(t1[4]) = RE(t0[4]) + RE(t0[5]);
IM(t1[4]) = IM(t0[4]) + IM(t0[5]);
RE(t1[5]) = RE(t0[4]) - RE(t0[5]);
IM(t1[5]) = IM(t0[4]) - IM(t0[5]);
RE(t1[6]) = RE(t0[6]) + RE(t0[7]);
IM(t1[6]) = IM(t0[6]) + IM(t0[7]);
RE(t1[7]) = RE(t0[6]) - RE(t0[7]);
IM(t1[7]) = IM(t0[6]) - IM(t0[7]);
transpose2x4(t1, y);
}
/*******************************************************************************
16 points DFT (Winograd algorithm)
*******************************************************************************/
@ -391,6 +450,42 @@ void dft16 (complex_t *x, complex_t* y)
}
/*******************************************************************************
4 x 2 matrix transpose
*******************************************************************************/
void transpose4x2(complex_t *x, complex_t* y)
{
RE(y[ 0]) = RE(x[ 0]); IM(y[ 0]) = IM(x[ 0]);
RE(y[ 1]) = RE(x[ 4]); IM(y[ 1]) = IM(x[ 4]);
RE(y[ 2]) = RE(x[ 1]); IM(y[ 2]) = IM(x[ 1]);
RE(y[ 3]) = RE(x[ 5]); IM(y[ 3]) = IM(x[ 5]);
RE(y[ 4]) = RE(x[ 2]); IM(y[ 4]) = IM(x[ 2]);
RE(y[ 5]) = RE(x[ 6]); IM(y[ 5]) = IM(x[ 6]);
RE(y[ 6]) = RE(x[ 3]); IM(y[ 6]) = IM(x[ 3]);
RE(y[ 7]) = RE(x[ 7]); IM(y[ 7]) = IM(x[ 7]);
}
/*******************************************************************************
2 x 4 matrix transpose
*******************************************************************************/
void transpose2x4(complex_t *x, complex_t* y)
{
RE(y[ 0]) = RE(x[ 0]); IM(y[ 0]) = IM(x[ 0]);
RE(y[ 1]) = RE(x[ 2]); IM(y[ 1]) = IM(x[ 2]);
RE(y[ 2]) = RE(x[ 4]); IM(y[ 2]) = IM(x[ 4]);
RE(y[ 3]) = RE(x[ 6]); IM(y[ 3]) = IM(x[ 6]);
RE(y[ 4]) = RE(x[ 1]); IM(y[ 4]) = IM(x[ 1]);
RE(y[ 5]) = RE(x[ 3]); IM(y[ 5]) = IM(x[ 3]);
RE(y[ 6]) = RE(x[ 5]); IM(y[ 6]) = IM(x[ 5]);
RE(y[ 7]) = RE(x[ 7]); IM(y[ 7]) = IM(x[ 7]);
}
/*******************************************************************************
4 x 4 matrix transpose
*******************************************************************************/

Wyświetl plik

@ -25,11 +25,11 @@ all: $(EXE_FILES)
$(RELEASE_DIR)/%.exe:$(OBJ_DIR)/%.o $(DSPL_O)
$(CC) $< $(DSPL_O) -o $@ -ldl -lm
$(CC) $< $(DSPL_O) -o $@ $(LFLAGS)
$(OBJ_DIR)/%.o:$(SRC_DIR)/%.c
$(CC) $(CFLAGS) $< -o $@ -ldl -lm
$(CC) $(CFLAGS) $< -o $@ $(LFLAGS)
$(DSPL_O):$(DSPL_C)
$(CC) $(CFLAGS) $(DSPL_C) -o $(DSPL_O)

Wyświetl plik

@ -5,8 +5,8 @@
int main()
{
void* handle; // DSPL handle
handle = dspl_load(); // Load DSPL function
void* handle; /* DSPL handle */
handle = dspl_load(); /* Load DSPL function */
double a[5] = {0.0, 1.0, 2.0, 3.0, 4.0};
double b[5] = {5.0, 6.0, 7.0, 8.0, 9.0};
@ -17,27 +17,27 @@ int main()
err = vector_dot(a, b, 5, &r);
printf("\n\ndot product result: %d a^T * b = %f ", err, r);
// Concatenate arrays a and b. Result keeps to the array c
/* Concatenate arrays a and b. Result keeps to the array c */
err = concat((void*)a, 5*sizeof(double),
(void*)b, 5*sizeof(double), (void*)c);
printf("\n\nconcatenation result: %d\n\narray c = ", err);
for(k = 0; k < 10; k++)
printf("%6.1f", c[k]);
// Decimate array c 2 times. Result keeps to the array d
/* Decimate array c 2 times. Result keeps to the array d */
err = decimate(c, 10, 2, d, &n);
printf("\n\ndecimation result: %d\n\narray d = ", err);
for (k = 0; k < n; k++)
printf("%6.1f", d[k]);
// find max abs value
/* find max abs value */
double am[5] = {0.0, 2.0, -5.0, 4.0, 2.0};
double m;
int ind;
err = find_max_abs(am, 5, &m, &ind);
printf("\n\nmax absolute value: %8.1f (index %d)", m, ind);
/* Flip in place */
printf("\n\nFlipip function test:\n\n");
double x[5] = {0.0, 1.0, 2.0, 3.0, 4.0};
int i;
@ -58,8 +58,8 @@ int main()
for(i = 0; i < 5; i++)
printf("%6.1f%+.1fj ", RE(y[i]), IM(y[i]));
dspl_free(handle); // free dspl handle
/* free dspl handle */
dspl_free(handle);
return err;
}

Wyświetl plik

@ -42,7 +42,7 @@ int main(int argc, char* argv[])
/* free dspl handle */
dspl_free(hdspl);
dspl_free(hdspl);
return 0;
}

Wyświetl plik

@ -3,8 +3,11 @@
#include <string.h>
#include "dspl.h"
#define ORD 3
#define N 1000
/* Filter order */
#define ORD 3
/* Frequency response vector size */
#define N 1000
int main(int argc, char* argv[])
@ -13,42 +16,42 @@ int main(int argc, char* argv[])
void* hplot; /* GNUPLOT handle */
/* Load DSPL functions */
hdspl = dspl_load();
hdspl = dspl_load();
double a[ORD+1]; /* Коэффициенты числителя H(s) */
double b[ORD+1]; /* Коэффициенты знаменателя H(s) */
double Rp = 1.0; /* Неравномерность АЧХ (к-т передачи на частоте 1 рад/c) */
double w[N]; /* Циклическая частота рад/c */
double mag[N]; /* АЧХ фильтра */
double phi[N]; /* ФЧХ фильтра */
double tau[N]; /* ГВЗ фильтра */
double a[ORD+1]; /* H(s) numerator coefficients vector */
double b[ORD+1]; /* H(s) denominator coefficients vector */
double Rp = 1.0; /* Magnitude ripple from 0 to 1 rad/s */
double w[N]; /* Angular frequency (rad/s) */
double mag[N]; /* Filter Magnitude (dB) */
double phi[N]; /* Phase response */
double tau[N]; /* Group delay */
int k;
/* Расчет коэффициентов фильтра */
/* H(s) coefficients calculation */
int res = butter_ap(Rp, ORD, b, a);
if(res != RES_OK)
printf("error code = 0x%8x\n", res);
/* Печать векторов коэффициентов */
/* Print H(s) coefficients */
for(k = 0; k < ORD+1; k++)
printf("b[%2d] = %9.3f a[%2d] = %9.3f\n", k, b[k], k, a[k]);
/* Частота в логарифмическом масштабе от 0.01 до 100 рад/с */
/* Frequency in logarithmic scale from 0.01 to 100 rad/s */
logspace(-2.0, 2.0, N , DSPL_SYMMETRIC, w);
/* Расчет частотных характеристик рассчитанного фильтра */
/* Filter frequency parameter calculation */
filter_freq_resp(b, a, ORD, w, N,
DSPL_FLAG_LOGMAG|DSPL_FLAG_UNWRAP|DSPL_FLAG_ANALOG,
mag, phi, tau);
/* сохранение рассчитанных характеристик в файлы */
/* Write Magnitude, phase response and group delay to the files */
writetxt(w, mag, N, "dat/butter_ap_test_mag.txt");
writetxt(w, phi, N, "dat/butter_ap_test_phi.txt");
writetxt(w, tau, N, "dat/butter_ap_test_tau.txt");
/* plotting by GNUPLOT */
/* plotting by GNUPLOT */
gnuplot_create(argc, argv, 920, 260, "img/butter_ap_test.png", &hplot);
gnuplot_cmd(hplot, "set logscale x");
gnuplot_cmd(hplot, "unset key");

Wyświetl plik

@ -3,10 +3,10 @@
#include <string.h>
#include "dspl.h"
/* Порядок фильтра */
/* Filter order */
#define ORD 4
/* размер векторов частотной характеристики фильтра */
/* Frequency response vector size */
#define N 1000
@ -16,33 +16,33 @@ int main(int argc, char* argv[])
void* hplot; /* GNUPLOT handle */
hdspl = dspl_load(); /* Load DSPL function */
double a[ORD+1]; /* Коэффициенты числителя H(s) */
double b[ORD+1]; /* Коэффициенты знаменателя H(s) */
double Rp = 1.0; /* Неравномерность АЧХ (к-т передачи на частоте 1 рад/c) */
double w[N]; /* Циклическая частота рад/c */
double mag[N]; /* АЧХ фильтра */
double phi[N]; /* ФЧХ фильтра */
double tau[N]; /* ГВЗ фильтра */
double a[ORD+1]; /* H(s) numerator coefficients vector */
double b[ORD+1]; /* H(s) denominator coefficients vector */
double Rp = 1.0; /* Magnitude ripple from 0 to 1 rad/s */
double w[N]; /* Angular frequency (rad/s) */
double mag[N]; /* Filter Magnitude (dB) */
double phi[N]; /* Phase response */
double tau[N]; /* Group delay */
int k;
/* рассчитываем нормированный ФНЧ Чебышева 1 рода */
/* H(s) coefficients calculation */
int res = cheby1_ap(Rp, ORD, b, a);
if(res != RES_OK)
printf("error code = 0x%8x\n", res);
/* печать коэффициентов фильтра */
/* Print H(s) coefficients */
for(k = 0; k < ORD+1; k++)
printf("b[%2d] = %9.3f a[%2d] = %9.3f\n", k, b[k], k, a[k]);
/* вектор частоты в логарифмической шакале от 0.01 до 100 рад/c */
/* Frequency in logarithmic scale from 0.01 to 100 rad/s */
logspace(-2.0, 2.0, N , DSPL_SYMMETRIC, w);
/* частотные характеристика фильтра */
/* Filter frequency parameter calculation */
filter_freq_resp(b, a, ORD, w, N,
DSPL_FLAG_LOGMAG|DSPL_FLAG_UNWRAP | DSPL_FLAG_ANALOG,
mag, phi, tau);
/* Сохранить характеристики для построения графиков */
/* Write Magnitude, phase response and group delay to the files */
writetxt(w, mag, N, "dat/cheby1_ap_test_mag.txt");
writetxt(w, phi, N, "dat/cheby1_ap_test_phi.txt");
writetxt(w, tau, N, "dat/cheby1_ap_test_tau.txt");

Wyświetl plik

@ -3,23 +3,23 @@
#include <string.h>
#include "dspl.h"
/* Порядок фильтра */
/* Filter order */
#define ORD 4
/* размер векторов частотной характеристики фильтра */
/* Frequency response vector size */
#define N 1000
int main(int argc, char* argv[])
{
void* hdspl; /* DSPL handle */
void* hplot; /* GNUPLOT handle */
double a[ORD+1]; /* Коэффициенты числителя H(s) */
double b[ORD+1]; /* Коэффициенты знаменателя H(s) */
double Rs = 60.0; /* Подавление АЧХ в полосе заграждения */
double w[N]; /* Циклическая частота рад/c */
double mag[N]; /* АЧХ фильтра */
double phi[N]; /* ФЧХ фильтра */
double tau[N]; /* ГВЗ фильтра */
void* hdspl; /* DSPL handle */
void* hplot; /* GNUPLOT handle */
double a[ORD+1]; /* H(s) numerator coefficients vector */
double b[ORD+1]; /* H(s) denominator coefficients vector */
double Rs = 60.0; /* Stopband suppression (dB) */
double w[N]; /* Angular frequency (rad/s) */
double mag[N]; /* Filter Magnitude (dB) */
double phi[N]; /* Phase response */
double tau[N]; /* Group delay */
int k;
/* Load DSPL function */
@ -30,24 +30,24 @@ int main(int argc, char* argv[])
return -1;
}
/* рассчитываем нормированный ФНЧ Чебышева 2 рода */
/* H(s) coefficients calculation */
int res = cheby2_ap(Rs, ORD, b, a);
if(res != RES_OK)
printf("error code = 0x%8x\n", res);
/* печать коэффициентов фильтра */
/* Print H(s) coefficients */
for(k = 0; k < ORD+1; k++)
printf("b[%2d] = %9.3f a[%2d] = %9.3f\n", k, b[k], k, a[k]);
/* вектор частоты в логарифмической шакале от 0.01 до 100 рад/c */
/* Frequency in logarithmic scale from 0.01 to 100 rad/s */
logspace(-2.0, 2.0, N , DSPL_SYMMETRIC, w);
/* частотные характеристика фильтра */
/* Filter frequency parameter calculation */
filter_freq_resp(b, a, ORD, w, N,
DSPL_FLAG_LOGMAG|DSPL_FLAG_UNWRAP | DSPL_FLAG_ANALOG,
mag, phi, tau);
/* Сохранить характеристики для построения графиков */
/* Write Magnitude, phase response and group delay to the files */
writetxt(w, mag, N, "dat/cheby2_ap_test_mag.txt");
writetxt(w, phi, N, "dat/cheby2_ap_test_phi.txt");
writetxt(w, tau, N, "dat/cheby2_ap_test_tau.txt");

Wyświetl plik

@ -3,26 +3,31 @@
#include <string.h>
#include "dspl.h"
/* DFT size */
#define N 16
int main()
{
void* handle; // DSPL handle
handle = dspl_load(); // Load DSPL function
double x[N]; // real input signal
complex_t y[N]; // DFT
void* handle; /* DSPL handle */
handle = dspl_load(); /* Load DSPL function */
double x[N]; /* real input signal */
complex_t y[N]; /* DFT vector */
int k;
/* fill input signal */
for(k = 0; k < N; k++)
x[k] = (double)k;
/* DFT calculation */
dft(x, N, y);
/* Print result */
for(k = 0; k < N; k++)
printf("y[%2d] = %9.3f%9.3f\n", k, RE(y[k]), IM(y[k]));
dspl_free(handle); // remember to free the resource
/* remember to free the resource */
dspl_free(handle);
return 0;
}

Wyświetl plik

@ -3,10 +3,10 @@
#include <string.h>
#include "dspl.h"
/* Порядок фильтра */
/* Filter order */
#define ORD 4
/* размер векторов частотной характеристики фильтра */
/* Frequency response vector size */
#define N 1000
@ -16,34 +16,34 @@ int main(int argc, char* argv[])
void* hplot; /* GNUPLOT handle */
hdspl = dspl_load(); /* Load DSPL function */
double a[ORD+1]; /* Коэффициенты числителя H(s) */
double b[ORD+1]; /* Коэффициенты знаменателя H(s) */
double Rp = 1.0; /* Неравномерность АЧХ (к-т передачи на частоте 1 рад/c) */
double Rs = 60.0;/* Подавление в полосе заграждения (дБ) */
double w[N]; /* Циклическая частота рад/c */
double mag[N]; /* АЧХ фильтра */
double phi[N]; /* ФЧХ фильтра */
double tau[N]; /* ГВЗ фильтра */
double a[ORD+1]; /* H(s) numerator coefficients vector */
double b[ORD+1]; /* H(s) denominator coefficients vector */
double Rp = 1.0; /* Magnitude ripple from 0 to 1 rad/s */
double Rs = 60.0;/* Stopband suppression (dB) */
double w[N]; /* Angular frequency (rad/s) */
double mag[N]; /* Filter Magnitude (dB) */
double phi[N]; /* Phase response */
double tau[N]; /* Group delay */
int k;
/* рассчитываем нормированный ФНЧ Чебышева 1 рода */
/* H(s) coefficients calculation */
int res = ellip_ap(Rp, Rs, ORD, b, a);
if(res != RES_OK)
printf("error code = 0x%8x\n", res);
/* печать коэффициентов фильтра */
/* Print H(s) coefficients */
for(k = 0; k < ORD+1; k++)
printf("b[%2d] = %9.3f a[%2d] = %9.3f\n", k, b[k], k, a[k]);
/* вектор частоты в логарифмической шакале от 0.01 до 100 рад/c */
/* Frequency in logarithmic scale from 0.01 to 100 rad/s */
logspace(-2.0, 2.0, N , DSPL_SYMMETRIC, w);
/* частотные характеристика фильтра */
/* Filter frequency parameter calculation */
filter_freq_resp(b, a, ORD, w, N,
DSPL_FLAG_LOGMAG|DSPL_FLAG_UNWRAP | DSPL_FLAG_ANALOG,
mag, phi, tau);
/* Сохранить характеристики для построения графиков */
/* Write Magnitude, phase response and group delay to the files */
writetxt(w, mag, N, "dat/ellip_ap_test_mag.txt");
writetxt(w, phi, N, "dat/ellip_ap_test_phi.txt");
writetxt(w, tau, N, "dat/ellip_ap_test_tau.txt");

Wyświetl plik

@ -3,38 +3,37 @@
#include <string.h>
#include "dspl.h"
/* FFT size */
#define N 18
int main()
{
void* handle; // DSPL handle
handle = dspl_load(); // Загрузка DSPL
complex_t x[N]; // массив входного сигнала
complex_t y[N]; // массив результата БПФ
fft_t pfft; // FFT объект
void* handle; /* DSPL handle */
handle = dspl_load(); /* Load libdspl */
complex_t x[N]; /* Input signal array */
complex_t y[N]; /* Output signal array */
fft_t pfft = {0}; /* FFT object (fill zeros) */
int k;
memset(&pfft, 0, sizeof(fft_t)); // Заполняем FFT структуру нулями
/* Fill FFT structure */
fft_create(&pfft, N);
fft_create(&pfft, N); // Создаем FFT структуру для длины N
// заполняем массив входного сигнала
/* Fill input signal x[k] = exp(j*k) */
for(k = 0; k < N; k++)
{
RE(x[k]) = (double)cos((double)k);
IM(x[k]) = (double)sin((double)k);
}
fft_cmplx(x, N, &pfft, y); // FFT
/* FFT */
fft_cmplx(x, N, &pfft, y);
// Печать результата
/* print result */
for(k = 0; k < N; k++)
printf("y[%2d] = %9.3f%9.3f\n", k, RE(y[k]), IM(y[k]));
fft_free(&pfft); // Очищаем структуру fft_t
dspl_free(handle); // Очищаем dspl handle
fft_free(&pfft); /* Clear fft_t object */
dspl_free(handle); /* Clear DSPL handle */
return 0;
}

Wyświetl plik

@ -3,35 +3,37 @@
#include <string.h>
#include "dspl.h"
/* FFT size */
#define N 14
int main()
{
void* handle; // DSPL handle
handle = dspl_load(); // Загрузка DSPL
double x[N]; // массив входного сигнала
complex_t y[N]; // массив результата БПФ
fft_t pfft; // FFT объект
void* handle; /* DSPL handle */
handle = dspl_load(); /* Load libdspl */
double x[N]; /* Input signal array */
complex_t y[N]; /* Output signal array */
fft_t pfft = {0}; /* FFT object (fill zeros) */
int k;
memset(&pfft, 0, sizeof(fft_t)); // Заполняем FFT структуру нулями
/* Fill FFT structure */
fft_create(&pfft, N);
fft_create(&pfft, N); // Создаем FFT структуру для длины N
// заполняем массив входного сигнала
/* Fill input signal x[k] = k */
for(k = 0; k < N; k++)
x[k] = (double)k;
fft(x, N, &pfft, y); // FFT
/* FFT */
fft(x, N, &pfft, y);
// Печать результата
/* print result */
for(k = 0; k < N; k++)
printf("y[%2d] = %9.3f%9.3f\n", k, RE(y[k]), IM(y[k]));
fft_free(&pfft); // Очищаем структуру fft_t
dspl_free(handle); // Очищаем dspl handle
fft_free(&pfft); /* Clear fft_t object */
dspl_free(handle); /* Clear DSPL handle */
return 0;
}

Wyświetl plik

@ -7,28 +7,33 @@
int main()
{
void* handle; // DSPL handle
handle = dspl_load(); // Load DSPL function
complex_t x[N]; // complex input signal
complex_t y[N]; // DFT
complex_t z[N]; // IDFT
void* handle; /* DSPL handle */
handle = dspl_load(); /* Load DSPL function */
complex_t x[N]; /* complex input signal */
complex_t y[N]; /* DFT */
complex_t z[N]; /* IDFT */
int k;
/* Fill input signal */
for(k = 0; k < N; k++)
{
RE(x[k]) = (double)k;
IM(x[k]) = 0.0;
}
/* DFT */
dft_cmplx(x,N,y);
/* IDFT */
idft_cmplx(y,N,z);
/* print result */
for(k = 0; k < N; k++)
printf("x[%2d] = %9.3f%+9.3fj, z[%2d] = %9.3f%+9.3f\n",
k, RE(x[k]), IM(x[k]), k, RE(z[k]), IM(z[k]));
dspl_free(handle); // remember to free the resource
dspl_free(handle); /* remember to free the resource */
return 0;
}

Wyświetl plik

@ -7,38 +7,39 @@
int main()
{
void* handle; // DSPL handle
handle = dspl_load(); // Загрузка DSPL
complex_t x[N]; // массив входного сигнала
complex_t y[N]; // массив результата БПФ
complex_t z[N]; // массив результата ОБПФ
fft_t pfft; // FFT объект
void* handle; /* DSPL handle */
handle = dspl_load(); /* Load libdspl */
complex_t x[N]; /* Input signal array */
complex_t y[N]; /* FFT Output signal array */
complex_t z[N]; /* IFFT Output signal array */
fft_t pfft = {0}; /* FFT object (fill zeros) */
int k;
memset(&pfft, 0, sizeof(fft_t)); // Заполняем FFT структуру нулями
fft_create(&pfft, N); // Создаем FFT структуру для длины N
// заполняем массив входного сигнала
/* Fill FFT structure */
fft_create(&pfft, N);
/* Fill input signal x[k] = exp(j*k) */
for(k = 0; k < N; k++)
{
RE(x[k]) = (double)cos((double)k);
IM(x[k]) = (double)sin((double)k);
}
fft_cmplx(x, N, &pfft, y); // FFT
ifft_cmplx(y, N, &pfft, z); // IFFT
// Печать результата
/* FFT */
fft_cmplx(x, N, &pfft, y);
/* FFT */
ifft_cmplx(y, N, &pfft, z);
/* print result */
for(k = 0; k < N; k++)
{
printf("| x[%2d] = %9.3f%9.3f ", k, RE(x[k]), IM(x[k]));
printf("| y[%2d] = %9.3f%9.3f ", k, RE(y[k]), IM(y[k]));
printf("| z[%2d] = %9.3f%9.3f |\n", k, RE(z[k]), IM(z[k]));
}
fft_free(&pfft); // Очищаем структуру fft_t
dspl_free(handle); // Очищаем dspl handle
fft_free(&pfft); /* Clear fft_t object */
dspl_free(handle); /* Clear DSPL handle */
return 0;
}