37 DEFUN (colloc, args, ,
39 @deftypefn {Built-in Function} {[@var{r}, @var{amat}, @var{bmat}, @var{q}] =} colloc (@var{n}, \"left\", \"right\")\n\
40 Compute derivative and integral weight matrices for orthogonal\n\
41 collocation using the subroutines given in J. Villadsen and\n\
42 M. L. Michelsen, @cite{Solution of Differential Equation Models by\n\
43 Polynomial Approximation}.\n\
48 int nargin = args.
length ();
50 if (nargin < 1 || nargin > 3)
56 if (! args(0).is_scalar_type ())
58 error (
"colloc: N must be a scalar");
62 double tmp = args(0).double_value ();
69 error (
"colloc: N cannot be NaN");
76 error (
"colloc: N must be positive");
84 for (
int i = 1; i < nargin; i++)
86 if (args(i).is_defined ())
88 if (! args(i).is_string ())
90 error (
"colloc: expecting string argument \"left\" or \"right\"");
94 std::string s = args(i).string_value ();
96 if ((s.length () == 1 && (s[0] ==
'R' || s[0] ==
'r'))
101 else if ((s.length () == 1 && (s[0] ==
'L' || s[0] ==
'l'))
108 error (
"colloc: unrecognized argument");
114 error (
"colloc: unexpected empty argument");
119 ntot += left + right;
122 error (
"colloc: the total number of roots must be positive");