-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckError.m
50 lines (43 loc) · 1.16 KB
/
checkError.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
% FILE: checkError.m
%
% FUNCTION: checkError
%
% CALL: check = checkError(deltaP, deltaP_max, deltaS, deltaS_max)
%
% Checks if deltaP < deltaP_max and deltaS < deltaS_max, and returns
% 1 if the conditions hold
%
% INPUTS:
% deltaP - computed value via another program
% deltaP_max - The maximum value for deltaP
% deltaS - computed value via another program
% deltaS_max - The maximum value for deltaS
%
% OUTPUTS:
% check - 1 if deltaP < deltaP_max and deltaS < deltaS_max
% 0 otherwise
%
%
%
% Author: Leonard-Gabriel Necula
% Created: December 24 2020
% Updated: January 18 2021
function check = checkError(deltaP, deltaP_max, deltaS, deltaS_max)
check = 0;
if nargin < 4
disp('All parameters are needed');
return;
elseif isempty(deltaP) || isempty(deltaS) || isempty(deltaP_max) || isempty(deltaS_max)
disp('Found empty value.');
return;
end
if deltaP > deltaP_max
check = 0;
return;
end
if deltaS > deltaS_max
check = 0;
return;
end
check = 1;
end