필터 지우기
필터 지우기

Matlab (Embedded) Function Block sample time

조회 수: 3 (최근 30일)
Emmanuel
Emmanuel 2013년 5월 2일
댓글: Abid Rahman Kodakkadan 2016년 2월 24일
Hey
I have a model that uses a variable step solver (ODE45). How do I ensure that the Matlab function blocks in my model are executed only once during each sample time, i.e. at the same sample time as the rest of my model considering that the sample time can vary with a variable step solver.
I know it is quite easy to do this with a fixed step solver. However my model requires a very small sample time (<0.01) to run with a fixed step solver (such as ODE4) to avoid singularities. Due to complexity of the matlab function block calculations performed, this is very very slow.
Appreciate any thoughts and advice to solve this problem!
Thanks in advance,
Emmanuel

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 2일
That depends on your embedded function inputs, if they came from a block with sample time, then set those sample time to inherited. If you can not, then pass those input through a zoh block with sample time set to inherited
  댓글 수: 2
Emmanuel
Emmanuel 2013년 5월 2일
should I set the sample time of the embedded matlab function blocks to inherited? If I do this then it seems to run multiple times each time step (during some time steps).
This is because I ask it to display some results in the command window and it seems to display the same results multiple times (during some time steps only!)
is there a way to 'tell' the embedded matlab block to 'grab' the current sample time from the rest of the simulation?
Abid Rahman Kodakkadan
Abid Rahman Kodakkadan 2016년 2월 24일
Is there any answer on this? I also experience this and the embedded function is taking in absurd values that a scope in simulink cannot detect. I also guess this is because the function executes multiple times during one simulation step.

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

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by