How to use the magicformula as a MATLAB function in simulink

3 ビュー (過去 30 日間)
Alice
Alice 2025 年 2 月 24 日
コメント済み: Sam Chak 2025 年 2 月 25 日
I have been trying to create a MATLAB function in simulink to use the magicformula built in function where i can just put in camber, slip angle etc... and get Fy and Mz. I saw that there is the built in simulink block, but Mz isn't there and i really need it as an output for my model. I knw that there is also the blocksets for vehicle dynamics but they don't do exactly what I want. Where I try to run my function, it says that the object oriented code in MagicFormulaTyre isn't supported by simulink. Is there any way to make it work? Thank you!!

回答 (1 件)

Sam Chak
Sam Chak 2025 年 2 月 24 日
There are two versions of the 'Magic' formulas. Can you mathematically derive ​ from their outputs? If so, you can write the derivation steps to the MATLAB Function block.
  2 件のコメント
Alice
Alice 2025 年 2 月 24 日

This is not what i want to use. Basically, I want to be able to put in my slip angle, camber, vertical force, side, longitudinal speed, slip ratio, and tire pressure in, and get out values of lateral force and aligning torque. There is a library on matlab which you can use, but i have been trying to upload it as a matlab function and it doesn’t work. There are a couple of errors going out, like that simulink does not have enough information to determine output sizes for this block, and the tireside which is an input in the matlab formula is not extracted because it isn’t a structure. Is this because simulink does not support every code that runs in matlab? The blocks that you are talking about are simscape which is not what i want. There is a block for the magic formula which i have because i added the library, but Mz isn’t an output.

Sam Chak
Sam Chak 2025 年 2 月 25 日
Are you referring to the Magic Formula Tire Force and Torque block? If you are writing a custom function within the MATLAB Function block, it is likely that your Magic Formula model contains unsupported functions, as Simulink does not support certain functions.
If you receive the message, 'Simulink does not have enough information to determine output sizes for this block,' it may indicate that the types for the block inputs and sizes for the block outputs are not specified correctly. I recommend taking a screenshot of your Simulink model so that other experts can assist you.

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

カテゴリ

Help Center および File ExchangeSources についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by