0

嗨,我正在尝试从地面插入温度高度。

知道了下面的信息tempA, heightA, tempB, heightB,我需要找到targetedTemperature出现的地方。

 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;
        }

我在这里找到了类似的问题https://stackoverflow.com/a/25882161/942855但不完全是我需要的。

4

0 回答 0