0

Below is a graph I want to use to measure loss over heat. A low heat and a high heat will signify a greater loss, whereas an average heat will signify a lesser loss.

  • Loss is left
  • Heat is bottom

The loss will have to have a maximum and minimum (Such as no more than 1, and no less than 0.5). The numbers used are purely fictional and can be replaced with anything else.

I apologise if this is vague, however while developing this application I realised that an algorythm will be far superior to a bunch of conditions.

The output I want would be something like this

What would the loss be at temperature X (I will always have the temperature, and only require the loss)

Unknown Graph

TheGeekZn
  • 113
  • 7

1 Answers1

1

I assume that $f(60)=f(0)$ (It doesn't really look so in your graph).

$h = $ highest, $l =$ lowest, $m = $ highest point's x-value, $p = $ period (60 in your graph).

Your function is:

$$f(x) = \frac{h-l}{2}cos \left( \frac{2\pi}{p}(x-m) \right) + \frac{h+l}{2}$$

For $h=0.9, l=0.6, m=0, p=60$ it looks like this:

enter image description here

Of course, there are many many other functions that looks almost the same. But I think that this is the most simple one.

Your graph looks more or less like $cos(x)$ that is stretched and moved. So I've looked for a function of the type:

$$Acos(Bx + C) + D$$

$A$ stretches it in the $y$-axis, $B$ stretches it in the $x$-axis, $C$ moves it in the $x$-axis, and $D$ moves it in the $y$-axis.

amirbd89
  • 1,052
  • Wow - this is really effective when transferring to my app. Let me run a few tests before I mark this as resolved. – TheGeekZn Jul 22 '15 at 08:47
  • Being a typical project, I just confirmed that the graph needs to extend behind 0 (Such as a temperature of -25). Is there any chance I could just add on 25 to the main temperature, then shift the graph back 25? – TheGeekZn Jul 22 '15 at 09:57
  • I don't fully understand your question... Probably because I don't understand what you are trying to model. This function is periodic. $f(-25) = f(p-25)$ – amirbd89 Jul 22 '15 at 10:35
  • I understand. you want to locate the "max" wherever you want. give me a minute, I'll re-edit my answer to include it as well. – amirbd89 Jul 22 '15 at 12:02
  • I'd actually like to begin an actual chat - what you have here seems to be perfect for me, I just need to be able to start at something like -25, and end off at like 40 (IF that's even possible - I see that my original graph looks pretty even which is misleading) – TheGeekZn Jul 22 '15 at 12:04
  • Re-editet my answer. It is possible. just set the highest point at $m= -25$ and in order for it to end at $40$, you need the period to be $p = 25+40 = 65$ – amirbd89 Jul 22 '15 at 12:08
  • How was the first function derived? –  Jul 22 '15 at 12:17
  • @amirbd89 Your latest edit is perfect – TheGeekZn Jul 22 '15 at 12:28