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.

Format of Function Block

0 votes
53 views
I am attempting to use the. function block in plecs standalone. I have 6 signals and want to have a single output. equal to -0.5*(max(u)-min(u)). Where max(u) would be the maximum value of any of the inputs. I get errors about the expression and the "(" positioning or use of max if I use the format above.

The help information says I can use max within the expression but I am unsure of the formatting. Thanks
asked Sep 3 by hugoc (28 points)

1 Answer

0 votes
 
Best answer

max(a, b) returns the maximum of the two values a and b. It only accepts two arguments. Getting the maximum of six input signals is a bit cumbersome:

max(u[1], max(u[2], max(u[3], max(u[4], max(u[5], u[6])))))

The same applies to min(a, b).

'u' only references the first input signal and is the same as u(1) or u[1].

You could also use intrinsic blocks (max, min, sum and gain) to achieve the desired functionality.

 

answered Sep 5 by Oliver Schwartz (495 points)
selected Sep 6 by hugoc
...