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.

C-Script for pwm input

0 votes
65 views
Hi

I want to know how to program the c-script for the attached matlab function

function a = fcn(x,ma,shift)

shift_k= shift*pi/180;              %converter degree to rad/s
a= (ma*(sin((x)+shift_k)));         %refernce voltage
asked Aug 3 by babackmn (20 points)

1 Answer

+1 vote

Firstly, why use a C-script for something so trivial?  You can easily build this out of basic PLECS components.

Secondly, please review the PLECS Tutorials on C-Scripts.  The "PLECS: Using the C-Script Block" tutorial should give you all the background needed to complete this task.  Refer specifically to Section 4 of the exercise which shows how to implement a basic mathematical function.  There also is a reference case in *.zip package you can download that is associated with the tutorial.

answered Aug 10 by Bryan Lieblick (280 points)
...