Use fixed-step solver ode1 to execute variable sample time Zero Order Hold

조회 수: 10 (최근 30일)
Zeren LU
Zeren LU 2017년 4월 13일
답변: Archit Dhanani 2019년 7월 25일
I got an error "Cannot compile diagram, because it contains variable sample times or S-functions and is using a fixed-step solver." when running a model which contains a variable sample time Zero Order Hold block written by S-function.
As fixed-step solver is a must for my simulation, I tried to solve this problem by(e.g):
1.set the fixed-step size as 1e-6 s;
2.keep the sample time of ZOH as n*(1e-6s), where n is a integer varies from 20 to 50;
I thought this may fix the problem as the sample time is integer multiple fixed-step size and the solver can solve this.
However, it does not work.
My question is, is there a way to implement a ZOH with variable sample time and use the fixed-step solver?

답변 (1개)

Archit Dhanani
Archit Dhanani 2019년 7월 25일
Simulink supports variable sample times for variable-step solvers only. You can read more about this in the page:
Could you try to use controllable sample times instead?

카테고리

Help CenterFile Exchange에서 Configure Simulation Conditions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by