Effect of Humidity on Electrochemical Sensor Signal and Seeking Correction Approaches

7 次查看(过去 30 天)
Hi everyone,
I've uploaded my dataset, which consists of a timetable with a model predictions, REF values (which my model should ideally match closely), humidity, and temperature readings. I've also included the plots I've generated based on this data.
The dataset I'm working with represents corrected signals from an electrochemical sensor. I've applied regression modeling and temperature correction to this data. Additionally, for the purpose of this analysis, I've removed outliers to ensure the data's reliability. Upon examining the plots, it's evident that as humidity levels fluctuate, they influence the overall signal. I believe there's a correlation here, especially since the impact spans over several hours, necessitating hours of data monitoring for accurate prediction.
While the sensor's output closely follows the trend of the reference signal, noticeable discrepancies arise in line with humidity changes. Specifically, the signal tends to overestimate when humidity increases and underestimate as it decreases. I've attempted to address this using the Regression Learner App and by comparing the error with humidity readings. However, I've not yet been successful in deriving a suitable correction factor or model. The challenge seems to be the need to assess prolonged data periods and discern if the humidity is rising or falling during those times.
Could anyone provide guidance or suggest an approach to tackle this issue?

采纳的回答

Star Strider
Star Strider 2023-10-24
Relative humidity will of course be affected by temperature, inbcreases as the temperature decreases, and it can never exceed 100%. It might be better to express humidity in terms of the dewpoint (the environmental temperature can never fall below the dewpoint) or absolute humidity, although this is also a function of temperature.
Plotting the data (‘Temperature’, ‘Humidity’, and the difference between ‘Predicted_DATA’ and ‘REF’) fails (to me,a t least) to reveal any patterns I might use to model them.
LD = load('REG_Model_Data.mat');
T1 = LD.cleaned_timetable_REG
T1 = 5305×5 table
Time Predicted_DATA REF Humidity Temperature ____________________ ______________ ____ ________ ___________ 16-Jan-2023 13:00:00 29.283 18.2 84.169 6.0208 16-Jan-2023 14:00:00 25.142 23.9 81.138 5.8618 16-Jan-2023 15:00:00 26.77 22.3 82.871 5.2763 16-Jan-2023 16:00:00 32.312 21.8 85.829 3.8196 16-Jan-2023 17:00:00 38.172 25.6 86.509 2.4975 16-Jan-2023 18:00:00 42.949 34.4 87.315 1.4005 16-Jan-2023 19:00:00 46.67 40.3 87.347 0.57429 16-Jan-2023 20:00:00 48.916 43.5 80.602 0.0084591 16-Jan-2023 21:00:00 53.266 47.8 80.225 -0.74979 16-Jan-2023 22:00:00 55.718 56.3 81.496 -1.2985 16-Jan-2023 23:00:00 55.289 54.3 82.048 -1.6424 17-Jan-2023 00:00:00 58.95 64.5 87.314 -1.5495 17-Jan-2023 01:00:00 59.48 66.4 91.808 -1.9128 17-Jan-2023 02:00:00 60.96 65.5 93.916 -2.2129 17-Jan-2023 03:00:00 58.813 62.3 95.008 -2.4581 17-Jan-2023 04:00:00 59.082 59.2 95.457 -2.5598
VN = T1.Properties.VariableNames;
delta = T1{:,3}-T1{:,2};
Lv = delta >= 0;
figure
scatter3(T1{Lv,4}, T1{Lv,5}, delta(Lv), '.g')
hold on
scatter3(T1{~Lv,4}, T1{~Lv,5}, delta(~Lv), '.r')
patch([xlim flip(xlim)], [[1 1]*min(ylim) [1 1]*max(ylim)], zeros(1,4), [1 1 1]*0.5, 'FaceAlpha',0.25)
hold off
grid on
xlabel(VN{4})
ylabel(VN{5})
zlabel([VN{3} ' - ' strrep(VN{2},'_','\_')])
view(-60,30)
figure
scatter(T1.Temperature, T1.Humidity,'.')
grid
xlabel('Temperature (°C)')
ylabel('Relative Humidity (%)')
% delta = TT1.Predicted_DATA - TT1.REF;
% pred = [TT1.Humidity TT1.Temperature];
% mdl = fitlm(pred, delta)
I would include humidity as an additional independent variable in your model (if you have not already) and proceed from there. I doubt that there is any way to predict it, other than noting the rate and direction of change in both humidity and temperature.
.
  23 个评论
Dharmesh Joshi
Dharmesh Joshi 2023-11-2
Thanks I will be expirment with your code. What i found it that using Regression Leaner App with GPR model is if i was to convert my Humidity data as Rate differnce as shown in the code below, it gives a little more insight into the effect Humditity has. I aim to feed this data also into your example.
timeIntervals = [1, 2, 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
% Ensure the timetable is sorted in ascending order by time
temptime_table = sortrows(temptime_table);
% Loop through each time interval and calculate the rate of change
for i = 1:length(timeIntervals)
interval = timeIntervals(i);
% Initialize a column for the rate of change
rateChange = NaN(height(temptime_table), 1);
% Calculate the rate of change for each row
for j = 1:height(temptime_table)
% Find the time point exactly 'interval' hours before the current time point
targetTime = temptime_table.Time(j) - hours(interval);
% Find the closest previous data point to the target time
previousIndex = find(temptime_table.Time <= targetTime, 1, 'last');
if ~isempty(previousIndex) && all(~isnan(temptime_table.Humidity([previousIndex, j])))
rateChange(j) = (temptime_table.Humidity(j) - temptime_table.Humidity(previousIndex)) / interval;
end
end
% Add the new column to the timetable
new_column_name = sprintf('HumidityRate_%dhr', interval);
temptime_table.(new_column_name) = rateChange;
end
Star Strider
Star Strider 2023-11-2
It might also be possible to use the gradient function with each of the associated variables as an additional input (covariate). It computes the numeric derivative (in this instance with respect to time), however like all high-pass filters (and the gradient or derivative is one such), it accentuates the noise, so noise has to be minimised first by smoothing the signal. (I prefer using the sgolayfilt function for this, using a 3-order polynomial and varying the ‘framelen’ until I get the result I want. The smoothdata function is also an option.)
If the data are not regularly sampled or the sampling interval is not known, compute the derivative as:
dydt = gradient(y) ./ gradient(t);
(assuming vector arguments of the same dimensions) and proceed from there.
Plotting the variables and their derivatives as functions of time will demonstrate if this is a suitable option.
It might also be appropriate to calculate and plot the derivatives of the viariables with respect to each other. This might provide insight into their relationships, even if those results are not included in the model.
.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Autocorrelated and Heteroscedastic Disturbances 的更多信息

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by