# How to use C-Script to generate a triangular wave with adjustable amplitude and frequency, and use the triangular wave as a carrier for modulation

**URL:** <https://forum.plexim.com/t/how-to-use-c-script-to-generate-a-triangular-wave-with-adjustable-amplitude-and-frequency-and-use-the-triangular-wave-as-a-carrier-for-modulation/2405>\
**Category:** PLECS\
**Tags:** plecs, c-script\
**Created:** [August 1, 2025, 3:19pm UTC](https://forum.plexim.com/t/how-to-use-c-script-to-generate-a-triangular-wave-with-adjustable-amplitude-and-frequency-and-use-the-triangular-wave-as-a-carrier-for-modulation/2405 "2025-08-01T15:19:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yangcheng](https://avatars.discourse-cdn.com/v4/letter/y/3be4f8/32.png) [@Yangcheng](https://forum.plexim.com/u/Yangcheng)\
**Post date:** [August 1, 2025, 3:19pm UTC](https://forum.plexim.com/t/how-to-use-c-script-to-generate-a-triangular-wave-with-adjustable-amplitude-and-frequency-and-use-the-triangular-wave-as-a-carrier-for-modulation/2405/1 "2025-08-01T15:19:14Z")

</div>

How to use C-Script to generate a triangular wave with adjustable amplitude and frequency, and use the triangular

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/0/0bc877d75f3a6557b92b05d7a5e3d612d6ace2c7.png)

wave as a carrier for modulation

---

<div class="post-metadata">

**Author:** ![Munadir\_Ahmed](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/munadir_ahmed/32/1540_2.png) [@Munadir\_Ahmed](https://forum.plexim.com/u/Munadir_Ahmed)\
**Post date:** [August 1, 2025, 7:10pm UTC](https://forum.plexim.com/t/how-to-use-c-script-to-generate-a-triangular-wave-with-adjustable-amplitude-and-frequency-and-use-the-triangular-wave-as-a-carrier-for-modulation/2405/2 "2025-08-01T19:10:10Z")

</div>

Hello, could you specify what you are trying to model? While the C-Script is very powerful I would be cautious in using it as it can cause you a lot of headache.

If you are simply looking for a variable frequency triangular waveform generator have a look at this ticket: [Triangular wave with variable frequency - #2 by Bryan\_Lieblick](https://forum.plexim.com/t/triangular-wave-with-variable-frequency/1152/2) .
