I have a list that describes a profile, such as the next one:
dat=[(0, 5),(1, 1),(3,1)]
I need to create a discretized version of that profile give a step of time 'dt=0.2'. For instance, the firs column of 'dat' would be:
dt = 0.2
time = np.linspace(dat[0][0],dat[-1][0],int(dat[-1][0]/dt)+1)
I need to assign the second value of the second column of data, so the new profile would be something like this:
0 | 5 |
0.2 | 5 |
0.4 | 5 |
0.6 | 5 |
0.8 | 5 |
1 | 5 |
1.2 | 1 |
1.4 | 1 |
1.6 | 1 |
1.8 | 1 |
2 | 1 |
2.2 | 1 |
2.4 | 1 |
2.6 | 1 |
2.8 | 1 |
3 | 1 |
How can I do this?