Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frequency Domain Errors From Systematic Sensor Errors package matlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TU-DA Fluidsystemtechnik
Public
Frequency Domain Errors From Systematic Sensor Errors package matlab
Commits
486491b3
Commit
486491b3
authored
May 21, 2024
by
Rexer, Manuel
Browse files
Options
Downloads
Patches
Plain Diff
added deadtime and calculation of overall uncertainty
parent
322c52a4
Branches
Branches containing commit
Tags
v1.4.0
Tags containing commit
1 merge request
!2
Update from Dissertation Rexer
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
package/propagateSysUncToFreqDomain.m
+48
-24
48 additions, 24 deletions
package/propagateSysUncToFreqDomain.m
package/underlying_functions/calculateSysUncInFreqDomain.m
+8
-4
8 additions, 4 deletions
package/underlying_functions/calculateSysUncInFreqDomain.m
with
56 additions
and
28 deletions
package/propagateSysUncToFreqDomain.m
+
48
−
24
View file @
486491b3
...
@@ -60,21 +60,21 @@ defaultHys = 0;
...
@@ -60,21 +60,21 @@ defaultHys = 0;
defaultFreq
=
[];
defaultFreq
=
[];
p
=
inputParser
;
p
=
inputParser
;
validScalarPosNum
=
@
(
x
)
isnumeric
(
x
)
&&
(
x
>
0
);
validScalarPosNum
=
@
(
x
)
isnumeric
(
x
)
&&
(
x
>
=
0
);
addOptional
(
p
,
'bias'
,
defaultBias
,
validScalarPosNum
);
addOptional
(
p
,
'bias'
,
defaultBias
,
validScalarPosNum
);
addOptional
(
p
,
's
lope
'
,
defaultSlope
,
validScalarPosNum
);
addOptional
(
p
,
's
ensitivity
'
,
defaultSlope
,
validScalarPosNum
);
addOptional
(
p
,
'lin'
,
defaultLin
,
validScalarPosNum
);
addOptional
(
p
,
'lin
earity
'
,
defaultLin
,
validScalarPosNum
);
addOptional
(
p
,
'hys'
,
defaultHys
,
validScalarPosNum
);
addOptional
(
p
,
'hys
teresis
'
,
defaultHys
,
validScalarPosNum
);
addOptional
(
p
,
'excitation_frequency'
,
defaultFreq
,
validScalarPosNum
)
addOptional
(
p
,
'excitation_frequency'
,
defaultFreq
,
validScalarPosNum
)
parse
(
p
,
varargin
{:})
parse
(
p
,
varargin
{:})
%% Generate the uncertainty data structure with the given input arguments
%% Generate the uncertainty data structure with the given input arguments
data
.
uncertainty
.
systematic
.
bias
=
p
.
Results
.
bias
;
data
.
uncertainty
.
systematic
.
bias
=
p
.
Results
.
bias
;
data
.
uncertainty
.
systematic
.
slope
=
p
.
Results
.
s
lope
;
data
.
uncertainty
.
systematic
.
slope
=
p
.
Results
.
s
ensitivity
;
data
.
uncertainty
.
systematic
.
lin
=
p
.
Results
.
lin
;
data
.
uncertainty
.
systematic
.
lin
=
p
.
Results
.
lin
earity
;
data
.
uncertainty
.
systematic
.
hys
=
p
.
Results
.
hys
;
data
.
uncertainty
.
systematic
.
hys
=
p
.
Results
.
hys
teresis
;
result_struct
.
excitation_frequency
=
p
.
Results
.
excitation_frequency
;
result_struct
.
excitation_frequency
=
p
.
Results
.
excitation_frequency
;
%% Pre Process the data
%% Pre Process the data
...
@@ -107,11 +107,14 @@ result_struct.number_of_cycles = getNumberOfCycles(time_vector, result_struct.ex
...
@@ -107,11 +107,14 @@ result_struct.number_of_cycles = getNumberOfCycles(time_vector, result_struct.ex
result_struct
.
FFT
.
N_data_points_in_FFT
=
length
(
result_struct
.
value_mean_vector
);
result_struct
.
FFT
.
N_data_points_in_FFT
=
length
(
result_struct
.
value_mean_vector
);
result_struct
.
FFT
.
value
=
fft
(
result_struct
.
value_mean_vector
);
result_struct
.
FFT
.
value
=
fft
(
result_struct
.
value_mean_vector
);
% result_struct.FFT.N_data_points_in_FFT = length(value_vector);
% result_struct.FFT.value = fft(value_vector);
% Calculate the statistical uncertainty
% Calculate the statistical uncertainty
% TODO: Maybe also write a test for the statistical uncertainty
% TODO: Maybe also write a test for the statistical uncertainty
temp_term1
=
result_struct
.
value_standartdeviation_vector
*
tinv
(
1
-
(
0.05
/
2
),
result_struct
.
number_of_cycles
-
1
);
temp_term1
=
result_struct
.
value_standartdeviation_vector
*
tinv
(
1
-
(
0.05
/
2
),
result_struct
.
number_of_cycles
-
1
)
/
sqrt
(
result_struct
.
number_of_cycles
)
;
temp_term2
=
(
sqrt
(
result_struct
.
number_of_cycles
))
^
2
*
result_struct
.
FFT
.
N_data_points_in_FFT
;
temp_term2
=
result_struct
.
FFT
.
N_data_points_in_FFT
;
data
.
uncertainty
.
statistical
=
sqrt
(
sum
(
temp_term1
/
temp_term2
)
)
;
data
.
uncertainty
.
statistical
=
sqrt
(
sum
(
temp_term1
.^
2
)
/
temp_term2
);
clearvars
temp_term1
temp_term2
clearvars
temp_term1
temp_term2
% Scale coefficients of the FFT
% Scale coefficients of the FFT
...
@@ -135,6 +138,14 @@ clearvars temp_term1 temp_term2
...
@@ -135,6 +138,14 @@ clearvars temp_term1 temp_term2
data
.
uncertainty
.
systematic
.
hys
,
...
data
.
uncertainty
.
systematic
.
hys
,
...
result_struct
.
FFT
.
value
);
result_struct
.
FFT
.
value
);
%% Calculate uncertainty rising from sampling rate
% Asumption: the actually measured value can is inbetween two sample points
% therefore we ad an deadtime uncertainty of +- sampletime
% This affects only the phase of the measurement in frequency domain
result_struct
.
FFT
.
uncertainty
.
deadtime
.
phase
=
0.5
*
0.95
*
sampletime
*
2
*
pi
*
result_struct
.
FFT
.
frequencies
;
result_struct
.
FFT
.
uncertainty
.
deadtime
.
absolute
=
0
*
result_struct
.
FFT
.
frequencies
;
%% Calculate resulting overall uncertainty
%% Calculate resulting overall uncertainty
% random uncertainty
% random uncertainty
...
@@ -150,22 +161,35 @@ result_struct.FFT.uncertainty.statistical.phase(1) = 0;
...
@@ -150,22 +161,35 @@ result_struct.FFT.uncertainty.statistical.phase(1) = 0;
% sum up
% sum up
result_struct
.
FFT
.
uncertainty
.
absolute
=
sqrt
(
...
result_struct
.
FFT
.
uncertainty
.
absolute
=
sqrt
(
...
result_struct
.
FFT
.
uncertainty
.
statistical
.
absolute
.^
2
+
...
result_struct
.
FFT
.
uncertainty
.
statistical
.
absolute
.^
2
+
...
result_struct
.
FFT
.
uncertainty
.
systematic
.
absolute
.^
2
);
result_struct
.
FFT
.
uncertainty
.
systematic
.
absolute
.^
2
+
...
result_struct
.
FFT
.
uncertainty
.
deadtime
.
absolute
.^
2
);
result_struct
.
FFT
.
uncertainty
.
phase
=
sqrt
(
...
result_struct
.
FFT
.
uncertainty
.
phase
=
sqrt
(
...
result_struct
.
FFT
.
uncertainty
.
statistical
.
phase
.^
2
+
...
result_struct
.
FFT
.
uncertainty
.
statistical
.
phase
.^
2
+
...
result_struct
.
FFT
.
uncertainty
.
systematic
.
phase
.^
2
);
result_struct
.
FFT
.
uncertainty
.
systematic
.
phase
.^
2
+
...
result_struct
.
FFT
.
uncertainty
.
deadtime
.
phase
.^
2
);
% conversion
temp1
=
atan
(
result_struct
.
FFT
.
uncertainty
.
phase
)
.*
abs
(
result_struct
.
FFT
.
value
);
% conversion from abs and phase to real and imag (complex number)
temp2
=
result_struct
.
FFT
.
uncertainty
.
absolute
.*
cos
(
angle
(
result_struct
.
FFT
.
value
))
+
...
1
i
*
result_struct
.
FFT
.
uncertainty
.
absolute
.*
sin
(
angle
(
result_struct
.
FFT
.
value
));
% Ansatz: gausian uncertaintypropagation
temp1
=
temp1
.*
cos
(
angle
(
result_struct
.
FFT
.
value
)
+
pi
/
2
)
+
...
result_struct
.
FFT
.
uncertainty
.
real
=
sqrt
(
cos
(
angle
(
result_struct
.
FFT
.
value
))
.^
2.
*
result_struct
.
FFT
.
uncertainty
.
absolute
.^
2
+
...
1
i
*
temp1
.*
sin
(
angle
(
result_struct
.
FFT
.
value
)
+
pi
/
2
);
abs
(
result_struct
.
FFT
.
value
)
.^
2.
*
sin
(
angle
(
result_struct
.
FFT
.
value
))
.^
2.
*
result_struct
.
FFT
.
uncertainty
.
phase
.^
2
);
result_struct
.
FFT
.
uncertainty
.
complex
=
...
result_struct
.
FFT
.
uncertainty
.
imag
=
sqrt
(
sin
(
angle
(
result_struct
.
FFT
.
value
))
.^
2.
*
result_struct
.
FFT
.
uncertainty
.
absolute
.^
2
+
...
abs
(
real
(
temp1
))
+
abs
(
real
(
temp2
))
+
...
abs
(
result_struct
.
FFT
.
value
)
.^
2.
*
cos
(
angle
(
result_struct
.
FFT
.
value
))
.^
2.
*
result_struct
.
FFT
.
uncertainty
.
phase
.^
2
);
1
i
*
(
abs
(
imag
(
temp1
))
+
abs
(
imag
(
temp2
)));
clear
temp1
temp2
result_struct
.
FFT
.
uncertainty
.
complex
=
result_struct
.
FFT
.
uncertainty
.
real
+
1
i
*
result_struct
.
FFT
.
uncertainty
.
imag
;
% Maximum estimation according to Rexer, not realy sutable
% temp1=atan(result_struct.FFT.uncertainty.phase).*abs(result_struct.FFT.value);
% temp2= result_struct.FFT.uncertainty.absolute.*cos(angle(result_struct.FFT.value))+...
% 1i*result_struct.FFT.uncertainty.absolute.*sin(angle(result_struct.FFT.value));
% temp1=temp1.*cos(angle(result_struct.FFT.value)+pi/2)+...
% 1i*temp1.*sin(angle(result_struct.FFT.value)+pi/2);
%
% result_struct.FFT.uncertainty.complex = ...
% abs(real(temp1))+abs(real(temp2))+...
% 1i*(abs(imag(temp1))+abs(imag(temp2)));
% clear temp1 temp2
% Mapping
% Mapping
...
...
This diff is collapsed.
Click to expand it.
package/underlying_functions/calculateSysUncInFreqDomain.m
+
8
−
4
View file @
486491b3
...
@@ -34,13 +34,13 @@ function [systematic_uncertainty_absolute, ...
...
@@ -34,13 +34,13 @@ function [systematic_uncertainty_absolute, ...
% (not always given)* obtained from the data sheet of the sensor that was
% (not always given)* obtained from the data sheet of the sensor that was
% used for the measurement or from calibration protocols.
% used for the measurement or from calibration protocols.
% Use 0 if there isn't a given value for your sensor.
% Use 0 if there isn't a given value for your sensor.
%
% -- sysunc_hysteresis scalar (1-by-1) real number of type double that
% -- sysunc_hysteresis scalar (1-by-1) real number of type double that
% represents the *hysteresis* systematic uncertainty and can be
% represents the *hysteresis* systematic uncertainty and can be
% *sometimes (not always given)* obtained from the data sheet of the
% *sometimes (not always given)* obtained from the data sheet of the
% sensor that was used for the measurement or from calibration protocols.
% sensor that was used for the measurement or from calibration protocols.
% Use 0 if there isn't a given value for your sensor.
% Use 0 if there isn't a given value for your sensor.
%
% -- FFT_Mean FFT of the mean value vector of the "statistic
% -- FFT_Mean FFT of the mean value vector of the "statistic
% oscillation".
% oscillation".
%
%
...
@@ -56,8 +56,12 @@ function [systematic_uncertainty_absolute, ...
...
@@ -56,8 +56,12 @@ function [systematic_uncertainty_absolute, ...
% given sensor.
% given sensor.
systematic_uncertainty_absolute
=
sysunc_bias
+
sysunc_slope
+
(
0.608
*
sysunc_linearity
);
systematic_uncertainty_absolute
=
ones
(
1
,
length
(
FFT_Mean
))
.*
...
systematic_uncertainty_phase
=
atan
(
0.681
*
sysunc_hysteresis
.
/
abs
(
FFT_Mean
));
((
0.95
*
sysunc_slope
.*
abs
(
FFT_Mean
))
+
(
0.263
*
sysunc_linearity
));
systematic_uncertainty_absolute
(
1
)
=
(
0.95
*
sysunc_bias
)
+
(
0.95
*
sysunc_slope
.*
abs
(
FFT_Mean
(
1
)))
+
(
0.263
*
sysunc_linearity
);
systematic_uncertainty_phase
=
atan
(
0.235
*
sysunc_hysteresis
.
/
abs
(
FFT_Mean
));
systematic_uncertainty_phase
(
1
)
=
0
;
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment