Hi I am trying to interpolate temperature height from ground.
Knowing the following information tempA, heightA, tempB, heightB, I need to find where targetedTemperature occurs.
public static double TemperatureHeight(
double heightA, double tempA,
double heightB, double tempB,
int targetTemperature)
{
//heightA = 4322.76; //height in Meters from ground
//heightB = 4989.064; //height in Meters from gound
//tempA = -9.9; // Temperature in celcius at heightA
//tempB = 13.6; // Temperature in celcius at height B
//targetTemperature = -10; //At what height from ground, this temperature exists?
//This is temporary solution, to pick closest height. Ideally I would like to know at what height (in meters) does targetTemperature exists.
if (targetTemperature - tempA > targetTemperature - tempB)
return heightB;
return heightA;
}
I found similar question here https://stackoverflow.com/a/25882161/942855 but not exactly what I need.