I solved this problem by taking each location of a peak, using linspace to create the numbers 90-180 (as many numbers as I had time data points) between the peak and the next trough, then I did the same for between the trough and the next peak (180-270) and that peak and the next trough (270-360) and from that trough onto the next peak (360-450).
Then I subtracted 360 from any number over 360 to make all the values range from 0-360 in a correct sin function.