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.

complex numbers in PLECS C-script

0 votes

I tried to write a complex number in C-script.

#include <complex.h>

float j;

j = csqrt(-1);

It's a code on the top for complex numbers.

what's problem ?
asked Jun 16, 2020 by lucia (12 points)

1 Answer

+1 vote
PLECS C-Scripts support complex numbers.  The issue is that you must define your variable as a complex number in your code declarations.  For example "float complex a;".

Attached is an example highlighting complex number usage in C-Scripts.  Note if a complex number is directly used as an output signal only the real component is used.  This is shown in the example.
answered Jun 16, 2020 by Bryan Lieblick (474 points)
edited Jun 17, 2020 by Bryan Lieblick