I have a list of data (measured per day) that I want to use as imput for another equation (say f). The problem is that the input I need for f needs to be a continuous function of time. Is it possible to change my data into a function? I would either like a function that is linear increasing or decreasing between the different timesteps (like the line you get when you use Joined
in ListPlot
) or a stepwise function that immediately jumps to another value the next day.
I tried using Interpolate
but then when I measured 0, I get negative values which is not possible for my measured values.
Hope someone could help me.
Simplified example:
tmin=1;
tmax=6;
data = {{1, 3}, {2, 0}, {3, 0}, {4, 5}, {5, 7}, {6, 10}};
ListPlot[data, AxesLabel -> {"time(day)", "data(mm)"}, Joined -> True]
f = Interpolation[data];
Plot[Evaluate[f[t]], {t, tmin, tmax}]
If you evaluate this: the first plot is the result I would prefer for my function, the second plot is not what I want as the values drop below 0.
tmin
andtmax
are not defined, can you edit your post so that these have values? $\endgroup$