MQ7 gas sensor TEMP and HUM compensation

Hi for all,
I use MQ7 gas sensor for CO detecting,
I have equation for temp and hum compensation, please see attached image,
(hr is humidity in range 0.0 to 1.0; t is temp in C)

I use this part of code to ppm calculation

//Calculation of PPM
void calculatePPM() {
  double lgPPM;
  Vrl = (double)adc_rd * Vadc_5;             // For 5V Vcc use Vadc_5  and  for 3V Vcc use Vadc_33
  Rs = Rl * (5 - Vrl)/Vrl;                         // Calculate sensor resistance
  ratio = Rs/Rl;                                     // Calculate ratio
  lgPPM = (log10(ratio) * -3.7)+ 0.9948;   // Calculate ppm
  ppm = pow(10,lgPPM);                         // Calculate ppm
}

can somebody advice how to implement that equation in code?
thanks
regards

The equation involves multiplication, addition, and the natural log function. It is trivial to implement. What are you trying to get from the equation? What have YOU tried? With what results?

Hi PaulS, thanks for reply,
I use MQ7 for CO measurement,
MQ7 data manual advice implementation temp and hum compensation, to get better result according real outdoor conditions,
manual in attach,

in original code Rl (load resistance) for MQ7 is defined 10K (recommended value is 5K to 47K, need to choice according real situation), and Rs is calculated from Rs = Rl * (5 - Vrl)/Vrl;
RATIO is a variable defined with Rs/Rl,
in this case RATIO depends only from Rl and analog read,

but this RATIO depend also from real temp and hum on location of use,
I found equation and I need advice how to implement,

//variables
const double Rl      = 10000.0;                     // Rl (Ohm) - Load resistance
const double Vadc_5  = 0.0048828125;         // ADC step 5V/1024 4,88mV (10bit ADC)
double Vrl;                                               // Output voltage
double Rs;                                               // Rs (Ohm) - Sensor resistance
double ppm;                                             // ppm
double ratio;                                            // Rs/Rl ratio

unsigned int adc_rd;

//Calculation of PPM
void calculatePPM() {
  double lgPPM;
  Vrl = (double)adc_rd * Vadc_5;               // For 5V Vcc use Vadc_5  and  for 3V Vcc use Vadc_33
  Rs = Rl * (5 - Vrl)/Vrl;                            // Calculate sensor resistance
  ratio = Rs/Rl;                                        // Calculate ratio
  lgPPM = (log10(ratio) * -3.7)+ 0.9948;     // Calculate ppm
  ppm = pow(10,lgPPM);                           // Calculate ppm
}

//Read sensor
void readSensor() {
  adc_rd = analogRead(analogPin);           
  delay(10);                                     // Pause 10ms
}
.
.
.

MQ-7 Ver1.3 - Manual.pdf (459 KB)