syntax error, Block error

13 views (last 30 days)
Ahmed Sayed
Ahmed Sayed on 13 Apr 2018
Answered: Rajanya on 14 Apr 2025
This is a small model of my problem.it is a simulink file. The values did not change. I tried to solve this problem, but it does not work.
If any of this system need to change, change it I need the initial values to be zeros

Answers (1)

Rajanya
Rajanya on 14 Apr 2025
The errors in the model are due to the fact that the expressions within the 'Fcn' block must be in terms of a predefined input variable 'u', which represents the single input that the block takes in. However, the model contains expressions using the custom signal names (like 'e', 'b' etc.), which the 'Fcn' blocks do not recognize, leading to syntax errors in the expressions.
Replacing all the expressions with 'u', in place of the custom names, solves all syntax errors (You will still get errors because the model contains algebraic loop but that is a different issue).
An example model to demonstrate the usage is provided below:
[ Note - a) 'u+2' is essentially equivalent to 'u(1)+2', and b) using 'b+2' instead of 'u+2' throws syntax error! ]
To learn more about the 'Fcn' block in Simulink, you can refer its documentation page by executing the following command from MATLAB Command Window:
doc Fcn
Thanks!

Categories

Find more on Modeling in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!