Syntax Error using Fcn Block

17 ビュー (過去 30 日間)
Jay Talreja
Jay Talreja 2020 年 9 月 7 日
コメント済み: Do 2023 年 6 月 9 日
I am trying to use Fcn Block but everytime i get this error
The Expression is (1/Mus)*(Ks*(u[3]-u[4])+Ct*(u([7]-u[2])+Kt*(u[6]-u[4])-u[5]) by taking 7 inputs through Mux and taking as input to Fcn Block
This is the error I am getting
The expression: (1/Mus)*(Ks*(u[3]-u[4])+Ct*(u([7]-u[2])+Kt*(u[6]-u[4])-u[5]) in 'Skyhook_Quater_Car_Me/Quater Car /Fcn1' has a syntax error
Can somebody help me on this..
Thanks in Advance

採用された回答

Jan
Jan 2020 年 9 月 7 日
編集済み: Jan 2020 年 9 月 7 日
You need round parentheses for indexing, not square brackets:
(1/Mus)*(Ks*(u[3]-u[4])+Ct*(u([7]-u[2])+Kt*(u[6]-u[4])-u[5])
% ==>
(1/Mus)*(Ks*(u(3)-u(4))+Ct*(u((7)-u(2))+Kt*(u(6)-u(4))-u(5))
When I insert your expression in Matlab's Command Window, I get the error message:
Error: Unbalanced or unexpected parenthesis or bracket.
and a mark under the first square bracket.
  2 件のコメント
Jay Talreja
Jay Talreja 2020 年 9 月 7 日
編集済み: Jay Talreja 2020 年 9 月 7 日
Error while parsing expression:
(1/Mus)*(Ks*(u(3)-u(4))+Ct*(u((7)-u(2))+Kt*(u(6)-u(4))-u(5))
in 'Skyhook_Quater_Car_Me/Quater Car /Fcn1' token "" was found, whereas ")" was expected
This is the error I am getting now even after checking all the spaceing and brackets.
Jan
Jan 2020 年 9 月 7 日
You still have a different number of opening and closing parentheses. I cannot fix this for you, because I do not know the real fromula you want to use.

サインインしてコメントする。

その他の回答 (1 件)

Tufail Ahmad Bhat
Tufail Ahmad Bhat 2022 年 1 月 26 日
Did you solve the problem? I am getting the same error.
  1 件のコメント
Do
Do 2023 年 6 月 9 日
just replace "[" by "("

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by