Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

How can I write the following in C-Script block? [closed]

0 votes
h = 20000*sin((2*pi*f*T));

len = round(2/(f*dt));

for i = 2:len

if (i<len)

dH = h(i+1)-h(i);

if (dH>0)

delta = 1;


delta = -1;




where, the code above is written by matlab code and i want to use it in c-script. I'm already wrote some of code lines in c-script and working properly, actually I'm stuck in dH equation.

so please advice me to write it in c-script, you can check on the matlab code in attachment


closed with the note: i found the solution
asked May 16, 2021 by Yasir (14 points)
closed May 22, 2021 by Yasir