/
S1Grid.m
73 lines (57 loc) · 1.47 KB
/
S1Grid.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
classdef S1Grid
properties
points % the angles
min = 0 % start of fundamental region
max = 0 % end of fundamental region
periodic = false;
end
properties (Dependent = true)
period % = 0 if not periodic = max - min if periodic
end
methods
function G = S1Grid(arg1,min,max,varargin)
% Constructor
%
% Input
% points - double
% min - double
% max - double
%
% Output
% S1G - @S1Grid
%
% Options
% PERIODIC - periodic @S1Grid
if nargin == 0
elseif nargin == 1 % copy constructor
G.points = arg1.points;
G.min = arg1.min;
G.max = arg1.max;
G.periodic = arg1.periodic;
elseif nargin > 2
G.points = reshape(arg1,1,[]);
G.min = min(1);
G.max = max(1);
G.periodic = check_option(varargin,'PERIODIC');
if check_option(varargin,'matrix')
G.points = G.points(:,1);
G = repmat(G,size(arg1,2),1);
for i = 1:size(arg1,2)
G(i).min = min(i);
G(i).max = max(i);
G(i).points = arg1(:,i)';
end
end
else
error('wrong number of arguments')
end
end
function p = get.period(S1G)
if S1G.periodic
p = S1G.max-S1G.min;
else
p = 0;
end
end
end
end