This problem probably amounts to determining the constants of a curve. Furthermore, the "curve" is most likely a line:

Y = mX + K

Now, the fun part. I am trying to synthesize/derive a formula that will tell me how much insulin should a diabetic patient use: the OPTIMAL dosage.

Let's say that the person measures his glucose level every night and depending on its value, he injects himself some units of insulin. The target output is that the following morning the glucose should be between 100-120 mg/dl.

The more insulin the person uses, the lower the glucose BUT we don't want him to go into hypoglycemia.

I took a Control System class and recall that when some output is simultaneously input, we have a feedback control system. This seems to be the case here, as the sugar level is measured (input) in order to achieve a desired level (output).

I would like to start with the simplest case, with 3 parameters:

(1) The glucose level, G (2) The injected insulin, I (3) The time, t.

After taking many measurements (the number of them is fortunately not a constraint, can take them for weeks or months, for improved accuracy) a formula is derived, and we have reverse-engineered the glucose Control System.

That is all I have so far. Can you folks give me a hand?

TIA,

-RFH