Correcting effects of Humidity on sensors

44 views (last 30 days)
Dharmesh
Dharmesh on 23 Oct 2025 at 13:10
Commented: Star Strider about 11 hours ago
Hi All
I have gas sensor, that gets effected by hummdity that needs to be corrected. So was hoping to see if we can correct this ?
How can i run my code on the this support forum with my data file, so it can be run?

Answers (1)

Star Strider
Star Strider on 23 Oct 2025 at 14:11
What sort of correction do you want to do to your data?
Do you also have the humidity data?
Are there any published ways to correct the readings for humidity? If so, please share them.
To run your code with your data here, first upload the data file, using the 'paperclip' icon in the top toolbar (just to the right of the Σ). Click on the 'insert a line of doce' icon in the top toolbar (farthest left icon in the CODE section, or ALT+ENTER) to create a code line, then type or copy-paste your code in it. To run it, press the green arrrow in the top toolbar.
x = linspace(0, 2*pi);
y = sin(x) .* cos(x);
figure
plot(x, y)
grid
Your code should run here essentially the same way it runs on your computer, including reading the file.
,
  10 Comments
Dharmesh
Dharmesh 2 minutes ago
Edited: Dharmesh 2 minutes ago
Yes, what you’ve observed is correct as humidity changes, there is an exponential delay in returning to the baseline. Humidity transients are more noticeable in NO₂ and OX sensors, while NO sensors do not appear to be affected as much. I will ask the manufacturer why this occurs.
Here’s a small idea please advise if it’s feasible.
From simple observation, I can estimate what the baseline signal should be, assuming the humidity remains stable. At this stage, it might not be 100% accurate, but it could, in principle, generate a signal representing temperatures from 10°C to 45°C. This could be implemented as a simple lookup table.
We could then use this generated signal as a reference for what we expect the signal to be, and compare it with the actual WE signal using a model ,perhaps with the Regression Learner app.
If this approach works, we need to consider how to include humidity in the model. I don’t think relative humidity (RH) alone would be sufficient; instead, we may need to look at the rate of change (± humidity variation) over a certain duration. We can test different time windows for example, 1 min, 5 min, and 10 min . Some times humdity could be increasing slowly throught out the day.
Another important consideration is that the model should not rely on an absolute reference to the baseline. If a sensor has a different baseline, the correction should still work. Therefore, the correction factor should be expressed as a ± percentage relative to its baseline.
Star Strider
Star Strider about 2 hours ago
The 'lookup table' coould be implemented with one of the interpolation functions in core MATLAB. That part would not be difficult.
I have also been thinking about this with respect to the humidity transients, since that seems to be the most important problem.
Looking at the 'Humidity Transients' plot in 'App_note_v0', one option would be to re-create that experiment with numidity 'steps' and record the output. I am not certain what the sampling frequency would be, however considering that the note mentions that the numidity transients 'decay in about 10 minutes', sampling at 1 Hz might be enough, although more data is always better, so use a higher sampling frequency if system memory permits. Then use the System Identification Toolbox to derive the system structure (most likely a state space representation) choosing the appropriate order and using the compare function to determine the best system order. With that information, you can use the recorded humidity as an input, calculate the resulting output (simulate the state space representation with the recorded humidity signal), and then subtract that output signal from the observed result. That is the only way I can think of to correct for the transients. I doubt that any other approach would work.
The 'Humidity Transients' plot does not report either the input signal (probably some sort of step-wise humidity change) or the time, so using that plot as it exists would not be appropriate. (Without knowing the precise input signal and its shape, and the associated times, that plot is quantitatively useless.) It would be necessary to duplicate that experiment and mathematically identify the system in order to model the sensor response to humidity.
I can help with the system identification process once you have those data.
.

Sign in to comment.

Tags

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!