Mercurial > repos > public > sbplib
comparison +grid/Cartesian.m @ 943:21394c78c72e feature/utux2D
Merge with default
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Tue, 04 Dec 2018 15:24:36 -0800 |
parents | 031d6db97270 |
children |
comparison
equal
deleted
inserted
replaced
942:35701c85e356 | 943:21394c78c72e |
---|---|
14 % in each direction | 14 % in each direction |
15 function obj = Cartesian(varargin) | 15 function obj = Cartesian(varargin) |
16 obj.d = length(varargin); | 16 obj.d = length(varargin); |
17 | 17 |
18 for i = 1:obj.d | 18 for i = 1:obj.d |
19 assert(isvector(varargin{i}), 'Coordinate inputs must be a vectors.') | 19 assert(isnumeric(varargin{i}), 'Coordinate inputs must be vectors.') |
20 | 20 |
21 obj.x{i} = varargin{i}; | 21 obj.x{i} = varargin{i}; |
22 obj.m(i) = length(varargin{i}); | 22 obj.m(i) = length(varargin{i}); |
23 end | 23 end |
24 | 24 |
26 if obj.n == 0 | 26 if obj.n == 0 |
27 error('grid:Cartesian:EmptyGrid','Input parameter gives an empty grid.') | 27 error('grid:Cartesian:EmptyGrid','Input parameter gives an empty grid.') |
28 end | 28 end |
29 | 29 |
30 obj.h = []; | 30 obj.h = []; |
31 obj.lim = []; | 31 |
32 obj.lim = cell(1,obj.d); | |
33 for i = 1:obj.d | |
34 obj.lim{i} = {obj.x{i}(1), obj.x{i}(end)}; | |
35 end | |
32 end | 36 end |
33 % n returns the number of points in the grid | 37 % n returns the number of points in the grid |
34 function o = N(obj) | 38 function o = N(obj) |
35 o = obj.n; | 39 o = obj.n; |
36 end | 40 end |