Skip to content

Commit ceb0677

Browse files
committed
- ensured finite coordinates and finite RF data samples in function das_pw
- replaced < inf by isfinite
1 parent 2c49627 commit ceb0677

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

das_pw.m

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,24 @@
9191
error( errorStruct );
9292
end
9393

94+
% ensure finite x-coordinates
95+
if ~all( isfinite( positions_x ) )
96+
errorStruct.message = 'positions_x must contain finite x-coordinates!';
97+
errorStruct.identifier = 'das_pw:NoFiniteXCoordinates';
98+
error( errorStruct );
99+
end
100+
94101
% ensure numeric and real-valued row vector for positions_z
95102
if ~( isnumeric( positions_z ) && isreal( positions_z ) && isrow( positions_z ) )
96103
errorStruct.message = 'positions_z must be a numeric and real-valued row vector!';
97104
errorStruct.identifier = 'das_pw:NoNumericAndRealRowVector';
98105
error( errorStruct );
99106
end
100107

101-
% ensure positive z-coordinates
102-
if ~all( positions_z > 0 )
103-
errorStruct.message = 'positions_z must contain positive z-coordinates!';
104-
errorStruct.identifier = 'das_pw:NoPositiveZCoordinates';
108+
% ensure positive and finite z-coordinates
109+
if ~( all( positions_z > 0 ) && all( isfinite( positions_z ) ) )
110+
errorStruct.message = 'positions_z must contain positive and finite z-coordinates!';
111+
errorStruct.identifier = 'das_pw:NoPositiveAndFiniteZCoordinates';
105112
error( errorStruct );
106113
end
107114

@@ -119,6 +126,13 @@
119126
error( errorStruct );
120127
end
121128

129+
% ensure finite RF data
130+
if ~all( isfinite( data_RF ) )
131+
errorStruct.message = 'data_RF must contain finite samples!';
132+
errorStruct.identifier = 'das_pw:NoFiniteRFData';
133+
error( errorStruct );
134+
end
135+
122136
% ensure numeric and real-valued scalar for f_s
123137
if ~( isnumeric( f_s ) && isreal( f_s ) && isscalar( f_s ) )
124138
errorStruct.message = 'f_s must be a numeric and real-valued scalar!';
@@ -127,7 +141,7 @@
127141
end
128142

129143
% ensure positive and finite f_s
130-
if ~( f_s > 0 && f_s < Inf )
144+
if ~( f_s > 0 && isfinite( f_s ) )
131145
errorStruct.message = 'f_s must be positive and finite!';
132146
errorStruct.identifier = 'das_pw:InvalidSamplingRate';
133147
error( errorStruct );
@@ -155,7 +169,7 @@
155169
end
156170

157171
% ensure positive and finite element_width
158-
if ~( element_width > 0 && element_width < Inf )
172+
if ~( element_width > 0 && isfinite( element_width ) )
159173
errorStruct.message = 'element_width must be positive and finite!';
160174
errorStruct.identifier = 'das_pw:InvalidElementWidth';
161175
error( errorStruct );
@@ -169,7 +183,7 @@
169183
end
170184

171185
% ensure larger element_pitch than element_width and finite element_pitch
172-
if ~( element_pitch > element_width && element_pitch < Inf )
186+
if ~( element_pitch > element_width && isfinite( element_pitch ) )
173187
errorStruct.message = 'element_pitch must be larger than element_width and finite!';
174188
errorStruct.identifier = 'das_pw:InvalidElementPitch';
175189
error( errorStruct );
@@ -183,7 +197,7 @@
183197
end
184198

185199
% ensure positive and finite c_0
186-
if ~( c_0 > 0 && c_0 < Inf )
200+
if ~( c_0 > 0 && isfinite( c_0 ) )
187201
errorStruct.message = 'c_0 must be positive and finite!';
188202
errorStruct.identifier = 'das_pw:InvalidSpeedOfSound';
189203
error( errorStruct );

0 commit comments

Comments
 (0)