At the moment i am fitting a temperature profile that is equal to the sigmoid function (first picture).
But in some cases the temperature profile is not equal to the sigmoid function (second picture) and so i have to find another way to fit this profile.
White is the original temperature profile and the red/green is the fitted function.
You will see the fitting code at the end.
Can anybody help me?
One generally starts with a hypothesis, "I expect Reality to behave this way", which can also be expressed as a "model" such as "Temperature as a function of height should be a sigmoid". You do an experiment (or take some measurements), then test your hypothesis (fit your model). If the model fits, it does not prove your hypothesis, but can allow you to assume your hypothesis is true and then say something like "and the Critical Temperature is X degrees". If the model does not fit, it suggests that the hypothesis is false. The solution is to come up with an alternative hypothesis, but the hypothesis should come first! You can always exactly fit N data points with a polynomial of degree N+1, but that has no "explanatory value" (and is highly unlikely to generalize to a second data set).
Bottom line -- come up with your own alternative fitting function, preferably one that "makes sense" in the context of your study.