I am new to MATHLAB Simulink so I do not know how to code the MATLAB Function. Is what I do correct or wrong. I wanted to insert equation in the MATHLAB Function. Thank you so much for your help. Really apreciate it.

 採用された回答

Walter Roberson
Walter Roberson 2022 年 12 月 25 日

0 投票

MATLAB uses () for indexing. So u(1) not u[1]
I cannot read what is on line 3. It sort of looks like it might be
y = t;
if so it would be a problem because t is not defined.
The y that is being calculated on line 2 is a scalar, and it not obvious why you would want to transform it on line 3... it might be more clear if we could read the line.

3 件のコメント

Valentine Manggan Anak Alfred Jabu
Valentine Manggan Anak Alfred Jabu 2022 年 12 月 25 日
編集済み: Valentine Manggan Anak Alfred Jabu 2022 年 12 月 25 日
Hello sir thank you for the reply. Sorry for the inconvenience. Here is the full screenshot.
Walter Roberson
Walter Roberson 2022 年 12 月 25 日
your u appears to have at least two elements. When you assign y=u then all of the elements are copied to y. Because that is the first assignment to the variable, Simulink understands that you are doing that assignment in order to set the size and datatype of y.
Then after that you assign a scalar to the y that you just told Simulink is the same size as u.
You attempt to use [] for indexing but MATLAB and Simulink never use [] for indexing. As I indicated earlier use u(1) not u[1]
Valentine Manggan Anak Alfred Jabu
Valentine Manggan Anak Alfred Jabu 2022 年 12 月 29 日
Alright thanks for the help.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by