How to use max inside Simulink Fcn block?

조회 수: 3 (최근 30일)
winkmal
winkmal 2019년 9월 24일
댓글: winkmal 2019년 9월 24일
In my Simulink sheet, I have a Fcn block which does a very simple calculation from its input:
u(36)/u(38)*u(39)
Since the input can sometimes assume (unphysical) negative values, I wanted to exlude them:
max(0, u(36)/u(38)*u(39))
But as soon as I call the simulation, I get
The expression: max(0, u(36)/u(38)*u(39))
in '.../.../...'
has a syntax error
So does that mean that max is undefined inside Fcn blocks? If so, what could I use instead?
  댓글 수: 2
Ankit
Ankit 2019년 9월 24일
Fcn Block allows following mathematical function
Mathematical functions — abs, acos, asin, atan, atan2, ceil, cos, cosh, exp, floor, hypot, log, log10, power, rem, sgn (equivalent to sign in MATLAB®), sin, sinh, sqrt, tan, and tanh.
Just to confirm are you referring this block?: Fcn
winkmal
winkmal 2019년 9월 24일
> Just to confirm are you referring this block?: Fcn
Yes, indeed. I also noticed that the max function is not part of the list of available (mathematical) functions.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 9월 24일
Math Function Blocks https://www.mathworks.com/help/simulink/slref/mathfunction.html do not accept expressions: they only accept keywords.
You can build max() against a constant with https://www.mathworks.com/help/simulink/slref/minmax.html or with Saturate blocks.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by