-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProbe.m
71 lines (60 loc) · 1.72 KB
/
Probe.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
classdef Probe
properties
name; % what we should call this probe
d; % spin density, [1/g]
Gamma_0_pp; % anoxic linewidth, peak-to-peak, [G]
sensitivity; % [G / mmHg pO2]
end
properties (Dependent = true) % can only be read, not set
Gamma_0_hwhm; % anoxic linewidth, half-width at half-maximum, [G]
end
methods
% constructor
function probe = Probe(name, d, Gamma_0_pp, sensitivity)
probe.name = name;
probe.d = d;
probe.Gamma_0_pp = Gamma_0_pp;
probe.sensitivity = sensitivity;
end
% setter for property 'name'
function probe = set.name(probe, name)
if ~ischar(name)
error('Probe:invalid_property', ...
'name must be a character array');
else
probe.name = name;
end
end
% setter for property 'd'
function probe = set.d(probe, d)
if ~isfloat(d) || ~isscalar(d) || ~(d>0)
error('Probe:invalid_property', ...
'd must be a positive scalar float');
else
probe.d = d;
end
end
% setter for property 'Gamma_0_pp'
function probe = set.Gamma_0_pp(probe, Gamma_0_pp)
if ~isfloat(Gamma_0_pp) || ~isscalar(Gamma_0_pp) || ~(Gamma_0_pp>0)
error('Probe:invalid_property', ...
'Gamma_0_pp must be a positive scalar float');
else
probe.Gamma_0_pp = Gamma_0_pp;
end
end
% setter for property 'sensitivity'
function probe = set.sensitivity(probe, sensitivity)
if ~isfloat(sensitivity) || ~isscalar(sensitivity) || ~(sensitivity>0)
error('Probe:invalid_property', ...
'sensitivity must be a positive scalar float');
else
probe.sensitivity = sensitivity;
end
end
% getter for dependent property 'Gamma_0_hwhm'
function value = get.Gamma_0_hwhm(probe)
value = probe.Gamma_0_pp * sqrt(3)/2;
end
end
end