MATLAB Functionで計​算した値をSimsc​apeの解析動画に反​映させる方法について

33 vues (au cours des 30 derniers jours)
松
le 12 Sep 2025 à 4:14
Commenté : le 19 Sep 2025 à 11:22
Simscapeに関しての質問です。
添付したモデルはかなり簡略化したものです。重力加速度を0に設定し、2つのsolid blockをjointで接続しています。
やりたいことは、MATLAB Functionで速度を計算して、その値をsolid blockに反映することでMATLAB Function内で計算したものと実行した後に出てくる動画のsolidの挙動を全く同じものにしたいです。
方法がわかる方は教えていただけると幸いです。よろしくお願いいたします。

Réponse acceptée

Broy
Broy le 18 Sep 2025 à 6:12
Hi ,
I understand that you are trying to compute the velocity of a block inside MATLAB Function and then use that value to directly drive the motion of a solid in your Simscape Multibody model, so that the animation in Mechanics Explorer follows your calculated trajectory rather than being determined by physics alone.
To help with this, I have attached an updated version testmodel_2.slx that demonstrates the setup you described.
In the updated model, the following changes were made:
  • For the Prismatic Joint was configured so that Actuation → Force is set to Automatically Computed, and the Actuation → Motion setting was changed to Provided by Input.
  • For the Simulink-PS Converter, the Input Handling → Filtering and derivatives option was set to Filter input, derivatives calculated, and the Input Handling → Input filtering order was set to Second-order filtering.
  • Added a Clock block feeding the MATLAB Function (this is simply a time input to the function; you can change or replace it according to your needs).
  • Inserted a Simulink-PS Converter after the MATLAB Function.
With these changes, the Brick Solid now moves along the prismatic axis according to the velocity computed in the MATLAB Function. You can replace the function logic with your own calculation to reflect the motion you want.
Helpful documentation you can refer to:
I hope you find this useful.
  1 commentaire
松
le 19 Sep 2025 à 11:22
Thank you for your answer. I was able to resolve the issue.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!