Is it possible to plot a sequence of data without interpolating them? I would like to keep the value of one data point until the value of the next one.
So for example:
I have my time vector
time = [1 2 3 4 5 6]
and datapoints =[3 0 1 4 5 6]
I would like that the line of my plot is 3 from time(1) till time(2) and then it should change in time(2) to take the value 0. Basically in correspondence of the time 2 my plot should assume both the value 3 and 0 (jump discontinuity)...
I hope I was clear.
A short answer: yes you can.
Use the stairs() function.
time=[1 2 3 4 5 6];
datapoints = [3 0 1 4 5 6];
stairs(time,datapoints)
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With