全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
301 0
2013-04-07
PPVAL  Evaluate piecewise polynomial.
    V = PPVAL(PP,XX) returns the value, at the entries of XX, of the
    piecewise polynomial f contained in PP, as constructed by PCHIP, SPLINE,
    INTERP1, or the spline utility MKPP.

    V is obtained by replacing each entry of XX by the value of f there.
    If f is scalar-valued, then V is of the same size as XX. XX may be ND.

    If PP was constructed by PCHIP, SPLINE or MKPP using the orientation of
    non-scalar function values specified for those functions, then:

    If f is [D1,..,Dr]-valued, and XX is a vector of length N, then V has
    size [D1,...,Dr, N], with V(:,...,:,J) the value of f at XX(J).
    If f is [D1,..,Dr]-valued, and XX has size [N1,...,Ns], then V has size
    [D1,...,Dr, N1,...,Ns], with V(:,...,:, J1,...,Js) the value of f at
    XX(J1,...,Js).

    If PP was constructed by INTERP1 using the orientation of non-scalar
    function values specified for that function, then:

    If f is [D1,..,Dr]-valued, and XX is a scalar, then V has size
    [D1,...,Dr], with V the value of f at XX.
    If f is [D1,..,Dr]-valued, and XX is a vector of length N, then V has
    size [N,D1,...,Dr], with V(J,:,...,:) the value of f at XX(J).
    If f is [D1,..,Dr]-valued, and XX has size [N1,...,Ns], then V has size
    [N1,...,Ns,D1,...,Dr], with V(J1,...,Js,:,...,:) the value of f at
    XX(J1,...,Js).

    Example:
    Compare the results of integrating the function cos and its spline
    interpolant:

      a = 0; b = 10;
      int1 = quad(@cos,a,b);
      x = a:b; y = cos(x); pp = spline(x,y);
      int2 = quad(@(x)ppval(pp,x),a,b);

    int1 provides the integral of the cosine function over the interval [a,b]
    while int2 provides the integral, over the same interval, of the piecewise
    polynomial pp that approximates the cosine function by interpolating the
    computed x,y values.

    Class support for input X and the fields of PP:
       float: double, single

    See also spline, pchip, interp1, mkpp, unmkpp, splines (The spline Toolbox).
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群