Syntax error , Component: Simulink, Category: Block error

I am trying to create user defined function fcn using following formulas which is giving me syntax error
Formulas are : 0.5*rho*Cd*A*(Velocity_mps)^2 and f*W*(1+(Velocity_mps/44.4))
I would like to know correct format for above formulas.
Thank you, Sameer

1 件のコメント

Saagar
Saagar 2014 年 9 月 17 日
could you post what you were trying and the error that it displayed?

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

回答 (1 件)

Sean de Wolski
Sean de Wolski 2014 年 9 月 17 日

0 投票

Looks okay to me as long as all numbers are scalars. If they are vectors or matrices, then you should add a . before the operations ^*/.
To help with this you can use vectorize:
vectorize ' 0.5*rho*Cd*A*(Velocity_mps)^2'
ans = 0.5.*rho.*Cd.*A.*(Velocity_mps).^2

カテゴリ

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

タグ

質問済み:

2014 年 9 月 17 日

回答済み:

2014 年 9 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by