syntax error, Block error

4 次查看(过去 30 天)
Ahmed Sayed
Ahmed Sayed 2018-4-13
回答: Rajanya 2025-4-14
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

回答(1 个)

Rajanya
Rajanya 2025-4-14
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!

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by