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.

invalid operands to binary expression ('double' and 'double') in c-script module what's wrong?

0 votes
231 views
I am a little confused when I use the following sentence in c-script:

d=(int)sqrt((InputSignal(0,0))^2+(InputSignal(1,0))^2);

the error message is as follows:

line 2: error: invalid operands to binary expression ('double' and 'double')

I have included math.h and stdio.h in the declaration page, so what's wrong?
asked Aug 2 by shichenseu (140 points)
Were you able to resolve this?

Is "d" an output or declared as an int?  All outputs are of type double by default.

Furthermore, it's not clear to me why you would cast the result to an integer, since the result will most often be a non-integer.
Did you try replacing InputSignal with a constant double/int to see if that's the Problem?

Please log in or register to answer this question.

...