Code covered by the BSD License  

Highlights from
Chebfun V4

image thumbnail

Chebfun V4



30 Apr 2009 (Updated )

Numerical computation with functions instead of numbers.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

{?double}) domain
classdef (InferiorClasses = {?double}) domain
% DOMAIN  Domain object constructor. 
% D = DOMAIN(A,B) or DOMAIN([A,B]) creates a domain object for the real
% interval [A,B]. If B<A an empty interval is returned.
% D = DOMAIN(V) for vector V of length at least 2 creates a domain for
% the interval [V(1),V(end)] with breakpoints at V(2:end-1). V is assumed
% to be correctly sorted with unique entries.
% The domain class is primarily used as a tool for creating linops, but it
% also has some other uses, including the chebfun overloads of the MATLAB
% ode routines (ode113, ode15s, and ode45) and interpolation routines
% (interp1, polyfit, and ratinterp).

% Copyright 2011 by The University of Oxford and The Chebfun Developers.
% See for Chebfun information.

        ends = []; % End and break points (should be at least a two-vector)

        function d = domain(varargin)

            % Parse the inputs
            if nargin == 0
                % Return an empty domain
            elseif isa(varargin{1},'domain')
                % Return input domain
                d = varargin{1};
            % Concatenate multi-inputs
            v = cat(2,varargin{:});     
            % Deal with empty intervals
            if (length(v) > 1) && (v(end) < v(1))
                v = [];
            % For scalar input, make a two-vector
            if length(v) == 1, v = [v v]; end

            % Add the ends to the output domain
            d.ends = v;



Contact us