Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
locupe
mexec
Commits
80752ef4
Commit
80752ef4
authored
5 years ago
by
PStar User Account
Browse files
Options
Download
Email Patches
Plain Diff
mcoxyhyst_reverse that handles missing data
parent
ae63b40b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
20 deletions
+34
-20
source/mextras/mcoxyhyst_reverse.m
source/mextras/mcoxyhyst_reverse.m
+34
-20
No files found.
source/mextras/mcoxyhyst_reverse.m
View file @
80752ef4
function
[
oxygen_rev
]
=
mcoxyhyst_reverse
(
oxygen_sbe
,
time
,
press
,
H1
,
H2
,
H3
)
function
[
oxygen_rev
]
=
mcoxyhyst_reverse
(
oxygen_sbe
,
time
,
press
,
H1
,
H2
,
H3
)
% function [oxygen_rev]=mcoxyhyst_reverse(oxygen_sbe,time,press,H1,H2,H3)
% function [oxygen_rev]=mcoxyhyst_reverse(oxygen_sbe,time,press,H1,H2,H3)
%
%
% gdm on di346
% gdm on di346
% function to reverse the adjustment for hysteresis in the oxygen sensor
% function to reverse the adjustment for hysteresis in the oxygen sensor
% applied by SeaBird
% applied by SeaBird
%
%
% the default values and ranges or the constants are:
% the default values and ranges or the constants are:
% H1 -0.033 [-0.02 to -0.05]
% H1 -0.033 [-0.02 to -0.05]
% H2 5000
% H2 5000
% H3 1450 [1200 to 2000]
% H3 1450 [1200 to 2000]
oxygen_rev
=
oxygen_sbe
;
% DAS chnaged to deal with absent data but note this could give slightly different results from original data as
% the sbe software may deal with absent data differently
for
k
=
2
:
length
(
time
)
D
=
1
+
H1
*
(
exp
(
press
(
k
)/
H2
)
-
1
);
oxygen_rev
=
oxygen_sbe
;
C
=
exp
(
-
1
*
(
time
(
k
)
-
time
(
k
-
1
))/
H3
);
kfirst
=
min
(
find
(
isfinite
(
oxygen_sbe
)));
oxygen_rev
(
k
)
=
D
*
(
oxygen_sbe
(
k
)
-
C
*
oxygen_sbe
(
k
-
1
))
+
C
*
oxygen_rev
(
k
-
1
);
klastgood
=
kfirst
;
% keep track of most recent good cycle
for
k
=
2
:
length
(
time
)
D
=
1
+
H1
*
(
exp
(
press
(
k
)/
H2
)
-
1
);
C
=
exp
(
-
1
*
(
time
(
k
)
-
time
(
k
-
1
))/
H3
);
oxygen_rev
(
k
)
=
D
*
(
oxygen_sbe
(
k
)
-
C
*
oxygen_sbe
(
k
-
1
))
+
C
*
oxygen_rev
(
k
-
1
);
if
isnan
(
oxygen_sbe
(
k
)
+
press
(
k
))
oxygen_rev
(
k
)
=
nan
;
%already the case because of initialisation of oxygen_out
else
if
press
(
k
)
<
0
;
press
(
k
)
=
0
;
end
D
=
1
+
H1
*
(
exp
(
press
(
k
)/
H2
)
-
1
);
C
=
exp
(
-
1
*
(
time
(
k
)
-
time
(
klastgood
))/
H3
);
oxygen_rev
(
k
)
=
D
*
(
oxygen_sbe
(
k
)
-
C
*
oxygen_sbe
(
klastgood
))
+
C
*
oxygen_rev
(
klastgood
);
klastgood
=
k
;
end
end
;
end
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment