0

This answer here : Is there a one-line function that generates a triangle wave? describes a method of producing a triangular wave using a variable of x in a single loop. I am using a simulator(PSIM with the C block) and I need to produce triangular wave in Realtime or the WHOLE simulation time using t(Realtime) perhaps. Is there a method to do so?

Trex
  • 21
  • 3
  • 3
    There will be a one-line function to call if you write one! The math used in that linked question is fine. The difference is if you're running it in real time, then you do it one sample at a time instead of in a loop. In audio applications, usually there's a small buffer, but you know the buffer size and sample rate, so you can calculate/update the time as you go and output the wave in small chunks. At a minimum, to generate the wave you need to know the time and you need to specify its frequency. – paddy Nov 24 '21 at 12:51

0 Answers0