Hi
I want to know how to program the c-script for the attached matlab function
function a = fcn(x,ma,shift)
shift_k= shiftpi/180; %converter degree to rad/s
a= (ma(sin((x)+shift_k))); %refernce voltage
C-Script.docx (24.7 KB)
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.