Polynomial curve fitting, roots, derivatives, integration, 1D/2D/3D interpolation, and piecewise cubic splines. More...
Files | |
| file | polyfun.hpp |
Classes | |
| struct | nk::builtin::PolyDiv |
| Result of polynomial division and deconvolution ([q, r] = polydiv(b, a)). More... | |
| struct | nk::builtin::PadeCoef |
| Padé approximation numerator and denominator polynomials. More... | |
| struct | nk::builtin::ResidueResult |
| Result of partial fraction expansion (residues, poles, direct term). More... | |
| struct | nk::builtin::MatchpairsResult |
| Result of linear assignment problem (matchpairs). More... | |
| struct | nk::builtin::InpolygonResult |
| Result of 2-D polygon inclusion test (inpolygon). More... | |
| struct | nk::builtin::PolyxpolyResult |
| Result of polygon intersection (polyxpoly). More... | |
Functions | |
| Value | nk::builtin::roots (const Value &p, std::pmr::memory_resource *mr=nullptr) |
| Computes polynomial roots (roots(p)). | |
| Value | nk::builtin::poly (const Value &r, std::pmr::memory_resource *mr=nullptr) |
| Polynomial with specified roots or characteristic polynomial of a matrix. | |
| Value | nk::builtin::polyval (const Value &p, const Value &x, std::pmr::memory_resource *mr=nullptr) |
| Evaluates polynomial p at points x via Horner's scheme. | |
| Value | nk::builtin::polyder (const Value &p, std::pmr::memory_resource *mr=nullptr) |
| Computes polynomial derivative (polyder(p)). | |
| std::tuple< Value, Value > | nk::builtin::polyder (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Computes derivative of polynomial quotient b / a ([q, d] = polyder(b, a)). | |
| Value | nk::builtin::polyint (const Value &p, double k=0.0, std::pmr::memory_resource *mr=nullptr) |
| Computes polynomial integral (polyint(p, k)). | |
| Value | nk::builtin::polyfit (const Value &x, const Value &y, int n, std::pmr::memory_resource *mr=nullptr) |
| Polynomial least-squares curve fitting (polyfit(x, y, n)). | |
| Value | nk::builtin::polyvalm (const Value &p, const Value &A, std::pmr::memory_resource *mr=nullptr) |
| Matrix polynomial evaluation (polyvalm(p, A)). | |
| Value | nk::builtin::poly_of_matrix (const Value &A, std::pmr::memory_resource *mr=nullptr) |
| Characteristic polynomial of square matrix (poly_of_matrix(A)). | |
| PadeCoef | nk::builtin::padecoef (double T, int N, std::pmr::memory_resource *mr=nullptr) |
| Padé approximation of time delay ([num, den] = padecoef(T, N)). | |
| PolyDiv | nk::builtin::polydiv (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Polynomial deconvolution and division ([q, r] = polydiv(b, a)). | |
| std::tuple< Value, Value, Value > | nk::builtin::tf2zp (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Transfer function to zero-pole-gain conversion ([z, p, k] = tf2zp(b, a)). | |
| std::tuple< Value, Value > | nk::builtin::zp2tf (const Value &z, const Value &p, double k, std::pmr::memory_resource *mr=nullptr) |
| Zero-pole-gain to transfer function conversion ([b, a] = zp2tf(z, p, k)). | |
| ResidueResult | nk::builtin::residue (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Partial fraction expansion (residues) in Laplace s-domain ([r, p, k] = residue(b, a)). | |
| ResidueResult | nk::builtin::residuez (const Value &b, const Value &a, std::pmr::memory_resource *mr=nullptr) |
| Partial fraction expansion in Z-domain ([r, p, k] = residuez(b, a)). | |
| Value | nk::builtin::interp1 (const Value &x, const Value &v, const Value &xq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr) |
| 1-D table lookup and data interpolation (interp1(x, v, xq, method)). | |
| Value | nk::builtin::interp2 (const Value &V, const Value &Xq, const Value &Yq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr) |
| 2-D data interpolation on a grid (interp2(x, y, v, xq, yq, method)). | |
| Value | nk::builtin::interp2 (const Value &x, const Value &y, const Value &v, const Value &xq, const Value &yq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr) |
| 2-D data interpolation on a grid (interp2(x, y, v, xq, yq, method)). | |
| Value | nk::builtin::interp3 (const Value &V, const Value &Xq, const Value &Yq, const Value &Zq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr) |
| 3-D data interpolation on a uniform grid (interp3(V, Xq, Yq, Zq, method)). | |
| Value | nk::builtin::interp3 (const Value &X, const Value &Y, const Value &Z, const Value &V, const Value &Xq, const Value &Yq, const Value &Zq, const std::string &method="linear", std::pmr::memory_resource *mr=nullptr) |
| 3-D data interpolation on a grid (interp3(X, Y, Z, V, Xq, Yq, Zq, method)). | |
| Value | nk::builtin::spline (const Value &x, const Value &y, const Value &xq=Value(), std::pmr::memory_resource *mr=nullptr) |
| Cubic spline data interpolation (spline(x, y, xq)). | |
| Value | nk::builtin::pchip (const Value &x, const Value &y, const Value &xq=Value(), std::pmr::memory_resource *mr=nullptr) |
| Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) (pchip(x, y, xq)). | |
| Value | nk::builtin::makima (const Value &x, const Value &y, const Value &xq, std::pmr::memory_resource *mr=nullptr) |
| Modified Akima cubic Hermite interpolation (makima(x, y, xq)). | |
| Value | nk::builtin::mkpp (const Value &breaks, const Value &coefs, std::pmr::memory_resource *mr=nullptr) |
| Constructs a piecewise polynomial structure (ppform). | |
| Value | nk::builtin::unmkpp (const Value &pp, std::pmr::memory_resource *mr=nullptr) |
| Extracts piecewise polynomial structure fields ([breaks, coefs, l, k, d] = unmkpp(pp)). | |
| Value | nk::builtin::ppval (const Value &pp, const Value &xq, std::pmr::memory_resource *mr=nullptr) |
| Evaluates a piecewise polynomial structure at query points xq. | |
| Value | nk::builtin::gradient (const Value &f, double h=1.0, std::pmr::memory_resource *mr=nullptr) |
| Numerical gradient of 1-D array or uniform multi-dimensional array (gradient(f, h)). | |
| std::tuple< Value, Value > | nk::builtin::gradient2 (const Value &f, double hx=1.0, double hy=1.0, std::pmr::memory_resource *mr=nullptr) |
| Numerical 2-D gradient along rows and columns ([fx, fy] = gradient(f, hx, hy)). | |
| Value | nk::builtin::del2 (const Value &u, double h=1.0, std::pmr::memory_resource *mr=nullptr) |
| Five-point discrete Laplacian / Laplace operator (del2(u, h)). | |
| Value | nk::builtin::trapz (const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Trapezoidal numerical integration with unit spacing (trapz(y)). | |
| Value | nk::builtin::trapz (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Trapezoidal numerical integration over coordinates x (trapz(x, y)). | |
| Value | nk::builtin::trapz (const Value &x, const Value &y, int dim, std::pmr::memory_resource *mr=nullptr) |
| Trapezoidal numerical integration along specified dimension (trapz(x, y, dim)). | |
| Value | nk::builtin::cumtrapz (const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration with unit spacing (cumtrapz(y)). | |
| Value | nk::builtin::cumtrapz (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration over coordinates x (cumtrapz(x, y)). | |
| Value | nk::builtin::cumtrapz (const Value &x, const Value &y, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration along dimension (cumtrapz(x, y, dim)). | |
| Value | nk::builtin::cumtrapzDim (const Value &y, int dim, std::pmr::memory_resource *mr=nullptr) |
| Cumulative trapezoidal numerical integration with unit spacing along dimension (cumtrapz(y, dim)). | |
| Value | nk::builtin::integral (FnHandle fn, double a, double b, double absTol=1e-10, std::pmr::memory_resource *mr=nullptr) |
| Numerical 1-D adaptive quadrature integration (integral(fn, a, b)). | |
| Value | nk::builtin::integral2 (FnHandle fn, double a, double b, double c, double d, double absTol=1e-10, std::pmr::memory_resource *mr=nullptr) |
| Numerical 2-D double integration over rectangular region (integral2(fn, a, b, c, d)). | |
| Value | nk::builtin::integral3 (FnHandle fn, double a, double b, double c, double d, double e, double f, double absTol=1e-10, std::pmr::memory_resource *mr=nullptr) |
| Numerical 3-D triple integration over cuboid region (integral3(fn, a, b, c, d, e, f)). | |
| Value | nk::builtin::polyarea (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Area of 2-D polygonal contour (polyarea(x, y)). | |
| Value | nk::builtin::inpolygon (const Value &xq, const Value &yq, const Value &xv, const Value &yv, std::pmr::memory_resource *mr=nullptr) |
| Tests if 2-D query points are inside polygonal region (inpolygon(xq, yq, xv, yv)). | |
| InpolygonResult | nk::builtin::inpolygon2 (const Value &xq, const Value &yq, const Value &xv, const Value &yv, std::pmr::memory_resource *mr=nullptr) |
| Tests points inside and on edge of 2-D polygonal region ([in, on] = inpolygon(xq, yq, xv, yv)). | |
| Value | nk::builtin::convhull (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| Computes 2-D convex hull of planar point set (convhull(x, y)). | |
| PolyxpolyResult | nk::builtin::polyxpoly (const Value &x1, const Value &y1, const Value &x2, const Value &y2, std::pmr::memory_resource *mr=nullptr) |
| Intersection points of polygonal lines or boundaries ([xi, yi] = polyxpoly(x1, y1, x2, y2)). | |
| MatchpairsResult | nk::builtin::matchpairs (const Value &C, double cU, const std::string &mode="min", std::pmr::memory_resource *mr=nullptr) |
| Solves linear sum assignment problem with cost threshold (matchpairs(C, cU, mode)). | |
| Value | nk::builtin::boundary (const Value &x, const Value &y, double shrink=0.5, std::pmr::memory_resource *mr=nullptr) |
| Computes boundary / alpha-shape around 2-D point cloud (boundary(x, y, shrink)). | |
| Value | nk::builtin::delaunay (const Value &x, const Value &y, std::pmr::memory_resource *mr=nullptr) |
| 2-D Delaunay triangulation of planar point set (delaunay(x, y)). | |
| Value | nk::builtin::griddata (const Value &x, const Value &y, const Value &v, const Value &xq, const Value &yq, std::pmr::memory_resource *mr=nullptr) |
| Interpolates scattered 2-D data onto query points (griddata(x, y, v, xq, yq, method)). | |
| Value | nk::builtin::griddata (const Value &x, const Value &y, const Value &v, const Value &xq, const Value &yq, const std::string &method, std::pmr::memory_resource *mr=nullptr) |
| Interpolates scattered 2-D data onto query points with specified method (griddata(x, y, v, xq, yq, method)). | |
| Value | nk::builtin::griddatan (const Value &Xv, const Value &vv, const Value &xi, std::pmr::memory_resource *mr=nullptr) |
| N-D scattered data interpolation (griddatan(Xv, vv, xi, method)). | |
| Value | nk::builtin::griddatan (const Value &Xv, const Value &vv, const Value &xi, const std::string &method, std::pmr::memory_resource *mr=nullptr) |
| N-D scattered data interpolation with method (griddatan(Xv, vv, xi, method)). | |
| Value | nk::builtin::histcounts2 (const Value &x, const Value &y, const Value &xedgesV, const Value &yedgesV, std::pmr::memory_resource *mr=nullptr) |
| Computes 2-D bivariate histogram bin counts (histcounts2(x, y, xedges, yedges)). | |
Polynomial curve fitting, roots, derivatives, integration, 1D/2D/3D interpolation, and piecewise cubic splines.
| Value nk::builtin::boundary | ( | const Value & | x, |
| const Value & | y, | ||
| double | shrink = 0.5, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Computes boundary / alpha-shape around 2-D point cloud (boundary(x, y, shrink)).
| x | Point x-coordinates. |
| y | Point y-coordinates. |
| shrink | Shrink factor between 0.0 (convex hull) and 1.0 (compact boundary). |
| mr | Memory resource. |
| Value nk::builtin::cumtrapz | ( | const Value & | x, |
| const Value & | y, | ||
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Cumulative trapezoidal numerical integration along dimension (cumtrapz(x, y, dim)).
| x | Coordinate points. |
| y | Function values. |
| dim | Operating dimension. |
| mr | Memory resource. |
| Value nk::builtin::cumtrapz | ( | const Value & | x, |
| const Value & | y, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Cumulative trapezoidal numerical integration over coordinates x (cumtrapz(x, y)).
| x | Coordinate points. |
| y | Function values. |
| mr | Memory resource. |
Cumulative trapezoidal numerical integration with unit spacing (cumtrapz(y)).
| y | Function values. |
| mr | Memory resource. |
| Value nk::builtin::cumtrapzDim | ( | const Value & | y, |
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Cumulative trapezoidal numerical integration with unit spacing along dimension (cumtrapz(y, dim)).
| y | Function values. |
| dim | Operating dimension. |
| mr | Memory resource. |
| Value nk::builtin::del2 | ( | const Value & | u, |
| double | h = 1.0, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Five-point discrete Laplacian / Laplace operator (del2(u, h)).
| u | Input array. |
| h | Spacing between grid points (default 1.0). |
| mr | Memory resource. |
| Value nk::builtin::delaunay | ( | const Value & | x, |
| const Value & | y, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
2-D Delaunay triangulation of planar point set (delaunay(x, y)).
| x | Point x-coordinates. |
| y | Point y-coordinates. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::gradient2 | ( | const Value & | f, |
| double | hx = 1.0, | ||
| double | hy = 1.0, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Numerical 2-D gradient along rows and columns ([fx, fy] = gradient(f, hx, hy)).
| f | 2-D input matrix. |
| hx | Grid spacing along X. |
| hy | Grid spacing along Y. |
| mr | Memory resource. |
| Value nk::builtin::griddata | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | v, | ||
| const Value & | xq, | ||
| const Value & | yq, | ||
| const std::string & | method, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Interpolates scattered 2-D data onto query points with specified method (griddata(x, y, v, xq, yq, method)).
| x | Scattered point x-coordinates. |
| y | Scattered point y-coordinates. |
| v | Sample values at scattered points. |
| xq | Query point x-coordinates. |
| yq | Query point y-coordinates. |
| method | Interpolation method ("linear", "nearest", "cubic", "natural"). |
| mr | Memory resource. |
| Value nk::builtin::griddata | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | v, | ||
| const Value & | xq, | ||
| const Value & | yq, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Interpolates scattered 2-D data onto query points (griddata(x, y, v, xq, yq, method)).
| x | Scattered point x-coordinates. |
| y | Scattered point y-coordinates. |
| v | Sample values at scattered points. |
| xq | Query point x-coordinates. |
| yq | Query point y-coordinates. |
| mr | Memory resource. |
| Value nk::builtin::griddatan | ( | const Value & | Xv, |
| const Value & | vv, | ||
| const Value & | xi, | ||
| const std::string & | method, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
N-D scattered data interpolation with method (griddatan(Xv, vv, xi, method)).
| Xv | M x N sample point coordinates. |
| vv | Sample values. |
| xi | Query point coordinates. |
| method | Interpolation method ("linear", "nearest"). |
| mr | Memory resource. |
| Value nk::builtin::griddatan | ( | const Value & | Xv, |
| const Value & | vv, | ||
| const Value & | xi, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
N-D scattered data interpolation (griddatan(Xv, vv, xi, method)).
| Xv | M x N matrix of scattered sample point coordinates. |
| vv | M x 1 sample values. |
| xi | P x N matrix of query point coordinates. |
| mr | Memory resource. |
| Value nk::builtin::histcounts2 | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | xedgesV, | ||
| const Value & | yedgesV, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Computes 2-D bivariate histogram bin counts (histcounts2(x, y, xedges, yedges)).
| x | Data points x-coordinates. |
| y | Data points y-coordinates. |
| xedgesV | Bin edges vector along X. |
| yedgesV | Bin edges vector along Y. |
| mr | Memory resource. |
| Value nk::builtin::inpolygon | ( | const Value & | xq, |
| const Value & | yq, | ||
| const Value & | xv, | ||
| const Value & | yv, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Tests if 2-D query points are inside polygonal region (inpolygon(xq, yq, xv, yv)).
| xq | Query points x-coordinates. |
| yq | Query points y-coordinates. |
| xv | Polygon vertices x-coordinates. |
| yv | Polygon vertices y-coordinates. |
| mr | Memory resource. |
| InpolygonResult nk::builtin::inpolygon2 | ( | const Value & | xq, |
| const Value & | yq, | ||
| const Value & | xv, | ||
| const Value & | yv, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Tests points inside and on edge of 2-D polygonal region ([in, on] = inpolygon(xq, yq, xv, yv)).
| xq | Query points x-coordinates. |
| yq | Query points y-coordinates. |
| xv | Polygon vertices x-coordinates. |
| yv | Polygon vertices y-coordinates. |
| mr | Memory resource. |
| Value nk::builtin::integral | ( | FnHandle | fn, |
| double | a, | ||
| double | b, | ||
| double | absTol = 1e-10, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
| Value nk::builtin::integral2 | ( | FnHandle | fn, |
| double | a, | ||
| double | b, | ||
| double | c, | ||
| double | d, | ||
| double | absTol = 1e-10, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Numerical 2-D double integration over rectangular region (integral2(fn, a, b, c, d)).
| fn | Function handle taking (x, y). |
| a | Lower limit in x. |
| b | Upper limit in x. |
| c | Lower limit in y. |
| d | Upper limit in y. |
| absTol | Absolute error tolerance. |
| mr | Memory resource. |
| Value nk::builtin::integral3 | ( | FnHandle | fn, |
| double | a, | ||
| double | b, | ||
| double | c, | ||
| double | d, | ||
| double | e, | ||
| double | f, | ||
| double | absTol = 1e-10, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Numerical 3-D triple integration over cuboid region (integral3(fn, a, b, c, d, e, f)).
| fn | Function handle taking (x, y, z). |
| a | Lower limit in x. |
| b | Upper limit in x. |
| c | Lower limit in y. |
| d | Upper limit in y. |
| e | Lower limit in z. |
| f | Upper limit in z. |
| absTol | Absolute error tolerance. |
| mr | Memory resource. |
| Value nk::builtin::interp1 | ( | const Value & | x, |
| const Value & | v, | ||
| const Value & | xq, | ||
| const std::string & | method = "linear", | ||
| std::pmr::memory_resource * | mr = nullptr ) |
1-D table lookup and data interpolation (interp1(x, v, xq, method)).
| x | Sample grid points (strictly monotonic). |
| v | Sample values. |
| xq | Query points. |
| method | Interpolation method: "linear", "nearest", "next", "previous", "spline", "pchip". |
| mr | Memory resource. |
| Value nk::builtin::interp2 | ( | const Value & | V, |
| const Value & | Xq, | ||
| const Value & | Yq, | ||
| const std::string & | method = "linear", | ||
| std::pmr::memory_resource * | mr = nullptr ) |
2-D data interpolation on a grid (interp2(x, y, v, xq, yq, method)).
| x | Grid coordinates along columns. |
| y | Grid coordinates along rows. |
| v | Matrix of values on grid. |
| xq | Query points x-coordinates. |
| yq | Query points y-coordinates. |
| method | Interpolation method: "linear", "nearest", "cubic", "spline". |
| mr | Memory resource. |
2-D data interpolation on a uniform grid (interp2(V, Xq, Yq, method)).
| V | Matrix of values on default integer grid. |
| Xq | Query points x-coordinates. |
| Yq | Query points y-coordinates. |
| method | Interpolation method ("linear", "nearest", "cubic", "spline"). |
| mr | Memory resource. |
| Value nk::builtin::interp2 | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | v, | ||
| const Value & | xq, | ||
| const Value & | yq, | ||
| const std::string & | method = "linear", | ||
| std::pmr::memory_resource * | mr = nullptr ) |
2-D data interpolation on a grid (interp2(x, y, v, xq, yq, method)).
| x | Grid coordinates along columns. |
| y | Grid coordinates along rows. |
| v | Matrix of values on grid. |
| xq | Query points x-coordinates. |
| yq | Query points y-coordinates. |
| method | Interpolation method: "linear", "nearest", "cubic", "spline". |
| mr | Memory resource. |
| Value nk::builtin::interp3 | ( | const Value & | V, |
| const Value & | Xq, | ||
| const Value & | Yq, | ||
| const Value & | Zq, | ||
| const std::string & | method = "linear", | ||
| std::pmr::memory_resource * | mr = nullptr ) |
3-D data interpolation on a uniform grid (interp3(V, Xq, Yq, Zq, method)).
| V | 3-D array of values. |
| Xq | Query points x-coordinates. |
| Yq | Query points y-coordinates. |
| Zq | Query points z-coordinates. |
| method | Interpolation method. |
| mr | Memory resource. |
| Value nk::builtin::interp3 | ( | const Value & | X, |
| const Value & | Y, | ||
| const Value & | Z, | ||
| const Value & | V, | ||
| const Value & | Xq, | ||
| const Value & | Yq, | ||
| const Value & | Zq, | ||
| const std::string & | method = "linear", | ||
| std::pmr::memory_resource * | mr = nullptr ) |
3-D data interpolation on a grid (interp3(X, Y, Z, V, Xq, Yq, Zq, method)).
| X | Grid coordinates along X. |
| Y | Grid coordinates along Y. |
| Z | Grid coordinates along Z. |
| V | 3-D array of values. |
| Xq | Query points x-coordinates. |
| Yq | Query points y-coordinates. |
| Zq | Query points z-coordinates. |
| method | Interpolation method. |
| mr | Memory resource. |
| MatchpairsResult nk::builtin::matchpairs | ( | const Value & | C, |
| double | cU, | ||
| const std::string & | mode = "min", | ||
| std::pmr::memory_resource * | mr = nullptr ) |
| PadeCoef nk::builtin::padecoef | ( | double | T, |
| int | N, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Padé approximation of time delay ([num, den] = padecoef(T, N)).
Computes order-N Padé rational approximation of time delay exp(-s*T).
| T | Time delay in seconds. |
| N | Approximation order. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::pchip | ( | const Value & | x, |
| const Value & | y, | ||
| const Value & | xq = Value(), | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) (pchip(x, y, xq)).
| x | Sample grid points. |
| y | Sample values. |
| xq | Query points (or empty to return piecewise polynomial structure). |
| mr | Memory resource. |
| Value nk::builtin::polyarea | ( | const Value & | x, |
| const Value & | y, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Area of 2-D polygonal contour (polyarea(x, y)).
| x | Vertex x-coordinates. |
| y | Vertex y-coordinates. |
| mr | Memory resource. |
| std::tuple< Value, Value > nk::builtin::polyder | ( | const Value & | b, |
| const Value & | a, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Computes derivative of polynomial quotient b / a ([q, d] = polyder(b, a)).
| b | Numerator polynomial coefficients. |
| a | Denominator polynomial coefficients. |
| mr | Memory resource. |
| PolyDiv nk::builtin::polydiv | ( | const Value & | b, |
| const Value & | a, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Polynomial deconvolution and division ([q, r] = polydiv(b, a)).
| b | Dividend polynomial coefficients. |
| a | Divisor polynomial coefficients. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::polyfit | ( | const Value & | x, |
| const Value & | y, | ||
| int | n, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Polynomial least-squares curve fitting (polyfit(x, y, n)).
| x | Independent variable vector. |
| y | Dependent variable vector. |
| n | Degree of the fitting polynomial. |
| mr | Memory resource. |
| Value nk::builtin::polyvalm | ( | const Value & | p, |
| const Value & | A, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Matrix polynomial evaluation (polyvalm(p, A)).
Evaluates polynomial p at square matrix A using Horner's method with matrix multiplications: Y = p[0]*A^n + p[1]*A^(n-1) + ... + p[n]*I.
| p | Coefficient vector in descending powers of s. |
| A | Square matrix. |
| mr | Memory resource for allocations (nullptr for default). |
| PolyxpolyResult nk::builtin::polyxpoly | ( | const Value & | x1, |
| const Value & | y1, | ||
| const Value & | x2, | ||
| const Value & | y2, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Intersection points of polygonal lines or boundaries ([xi, yi] = polyxpoly(x1, y1, x2, y2)).
| x1 | First line x-coordinates. |
| y1 | First line y-coordinates. |
| x2 | Second line x-coordinates. |
| y2 | Second line y-coordinates. |
| mr | Memory resource. |
| ResidueResult nk::builtin::residue | ( | const Value & | b, |
| const Value & | a, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Partial fraction expansion (residues) in Laplace s-domain ([r, p, k] = residue(b, a)).
Converts transfer function B(s)/A(s) to partial fraction form: B(s)/A(s) = r(1)/(s-p(1)) + ... + r(n)/(s-p(n)) + k(s).
| b | Numerator polynomial coefficients in descending powers of s. |
| a | Denominator polynomial coefficients in descending powers of s. |
| mr | Memory resource for allocations (nullptr for default). |
| ResidueResult nk::builtin::residuez | ( | const Value & | b, |
| const Value & | a, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Partial fraction expansion in Z-domain ([r, p, k] = residuez(b, a)).
Converts discrete transfer function B(z)/A(z) to partial fraction form in z^-1: B(z)/A(z) = r(1)/(1 - p(1)*z^-1) + ... + k(z^-1).
| b | Numerator polynomial coefficients in descending powers of z. |
| a | Denominator polynomial coefficients in descending powers of z. |
| mr | Memory resource for allocations (nullptr for default). |
| Value nk::builtin::trapz | ( | const Value & | x, |
| const Value & | y, | ||
| int | dim, | ||
| std::pmr::memory_resource * | mr = nullptr ) |
Trapezoidal numerical integration along specified dimension (trapz(x, y, dim)).
| x | Coordinate points. |
| y | Function values. |
| dim | Dimension along which to integrate. |
| mr | Memory resource. |