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

조회 수: 8 (최근 30일)
松
2025년 9월 12일
댓글: 2025년 9월 19일
Simscapeに関しての質問です。
添付したモデルはかなり簡略化したものです。重力加速度を0に設定し、2つのsolid blockをjointで接続しています。
やりたいことは、MATLAB Functionで速度を計算して、その値をsolid blockに反映することでMATLAB Function内で計算したものと実行した後に出てくる動画のsolidの挙動を全く同じものにしたいです。
方法がわかる方は教えていただけると幸いです。よろしくお願いいたします。

채택된 답변

Arijeet
Arijeet 2025년 9월 18일
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
松
2025년 9월 19일
Thank you for your answer. I was able to resolve the issue.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 用途에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!