0
$\begingroup$

I have a set of excel data (time v temperature). When I extract it to mathematica it creates a matrix. I want to put the temperatures into a function that is time dependent, so is there a way to use these matrices to generate a function? Essentially, I want it so that if time = 6 hours, it will give a Temp value of 30.5, or whatever

$\endgroup$
  • $\begingroup$ Interpolation? $\endgroup$ – Sjoerd C. de Vries Mar 7 '16 at 22:30
  • $\begingroup$ Maybe Interpolation? $\endgroup$ – unlikely Mar 7 '16 at 22:30
6
$\begingroup$

Assuming your data is two columns: time, and temperature

data = First@Import["path_to_file.xlsx"]

(* Fake data from Thread[{Range[10], RandomInteger[{20, 40}, 10]}]
{{1, 21}, {2, 37}, {3, 39}, {4, 36}, {5, 37}, {6, 37}, {7, 22}, {8,  37}, {9, 37}, {10, 27}} 
*)

f = Interpolation@data;

f[1]
(* 21 *)

f[1.5]
(* 31.3125 *)

f[2]
(* 37 *)
| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.