function rp = rpmak(breaks,coefs,d)
%RPMAK Put together a rational spline in rpform.
%
%   RPMAK(BREAKS,COEFS) and RPMAK(BREAKS,COEFS,D) return the rpform of the 
%   rational spline specified by the input, with COEFS interpreted according
%   to whether or not the third input argument is present. 
%
%   This is exactly the output of PPMAK(BREAKS,COEFS,D+1) except that it is 
%   tagged to be the rpform of a rational spline, namely the rational spline 
%   whose denominator is provided by the last component of the spline, while 
%   its remaining components describe the numerator.  
%
%   In particular, the input coefficients must be (d+1)-vector valued for some
%   d>0.
%
%   For example, since ppmak([-5 5],[1 -10 26]) provides the ppform
%   of the polynomial  t |-> t^2+1  on the interval [-5 .. 5], while 
%   ppmak([-5 5], [0 0 1]) provides the ppform of the quadratic polynomial
%   t |-> 1  there, the command
%
%      runge = rpmak([-5 5],[0 0 1; 1 -10 26],1);
%
%   provides the rpform on the interval [-5 .. 5] for the rational function 
%   t |-> 1/(t^2+1)  famous from Runge's example concerning polynomial inter-
%   polation at equally spaced sites.
%
%   See also RPBRK, RSMAK, PPMAK, SPMAK, FNBRK.

%   Carl de Boor 09jan00
%   cb 07may00: handle trailing singleton dimensions
%   Copyright 1987-2000 by C. de Boor and The MathWorks, Inc.
%   $Revision: 1.5 $  $Date: 2000/05/24 14:59:21 $

if nargin>2
   d(1) = d(1)+1; rp = ppmak(breaks,coefs,d);
else
   rp = ppmak(breaks,coefs);
end

dp1 = fnbrk(rp,'dim');
if dp1==1
   error('A rational spline must have more than one component.')
end
rp.dim = dp1-1; rp.form = 'rp';
