Ideally, you would like to explain the LIDAR signal as a combination of one or more other variables, here LDR and/or Temperature and then remove the effect of those variables from the LIDAR signal.
The first part can be achieved with linear (hopefully) regression and specifically Multiple Linear Regression where you would be fitting a model like
LIDAR = Constant + LDR_Coef * LDR + Temp_Coef * Temp.
With the availability of just the LDR data (code in GNU Octave but easily transferable to other platforms too):
%Load the data
D = dlmread("myfile.txt",";"); %myfile.txt is the file you provided which is delimited by semicolon.
% Adjust the LDR signal
D(:,3) = log(D(:,3));
% Fit the model using regress.
% For more information see: https://octave.sourceforge.io/statistics/function/regress.html
[B, BINT, R, RINT, STATS] = regress(D(:,2), [ones(size(D(:,3))), D(:,3)]);
After you do this, you get your model coefficients in
B and a few other things (more about this later on).
It is now possible to express LIDAR as a function of LDR:
% Plot LIDAR and LIDAR as a function of LDR
xlabel('Time');ylabel('LIDAR / LDR');legend('LIDAR','LDR');grid on;
This now looks like:
This concludes with the fitting part. Now we want to remove the variation due to LDR, which is the "easy" part:
LIDAR_adjusted = D(:,2) - B(2).*D(:,3);
Which results in:
STATS vector contains a number of coefficients that inform you about how good is this fit. In this case
7.6591e-01 1.4952e+03 0.0000e+00 7.8229e-04. So, the $R^2$ is not ideal but not too bad too (that is the first number, it can be between $0$ and $1$ and it is ideal at $1$), the rest of the numbers are not bad too (the error is very small), but if you look at the residuals (that is the difference between the LIDAR and the LIDAR as a function of LDR) it is not exactly noise. Here is the residual (
Which results in:
There are clearly trends in the residual which means that LDR on its own cannot explain the variation in the LIDAR signal. You can add 'r' as a regressor in there, which would return three coefficients for the model
LIDAR = B(1) + B(2)*D(:,3) + B(3)*r and that would "take away" that linear upwards trend as a function of time and improve the error but you still get those two humps because the sensor responses are non-linear.
To conclude with this, if you wanted to add the temperature to the model too, just change the
regress line to:
[B, BINT, R, RINT, STATS] = regress(D(:,2), [ones(size(D(:,3)), D(:,3), D(:,4)]);
Assuming that you will add another column for the temperature. The rest of the process remains the same (with reasonable adjustments for removing the components further below).
The other thing that you can do of course is a Discrete Fourier Transform (just on the LIDAR) and retain the first few harmonics from it for detrending. The latter assumes that there is a periodic well defined effect of light (and / or temperature and other parameters) on LIDAR which can be approximated with a set of periodic components. And in that case, the adjustment comes as a function of the time of day "for free".
Hope this helps.