How to solve the the parameter 'SampleTime' must be a real double scalar (period) or a real double vector of length 2 (period, offset).

17 vues (au cours des 30 derniers jours)
the parameter 'SampleTime' must be a real double scalar (period) or a real double vector of length 2 (period, offset); where period, offset must be finite and non-negative and offset must be less than period.
  10 commentaires
困
le 30 Juil 2024
Déplacé(e) : Fangjun Jiang le 30 Juil 2024
I still came across this problem, Anyone knows how to fix it?
Fangjun Jiang
Fangjun Jiang le 30 Juil 2024
In this particular case, class(Ts) being 'single' was the root cause. The solution was to specify the sample time as 'double(Ts)'.

Connectez-vous pour commenter.

Réponses (2)

Fangjun Jiang
Fangjun Jiang le 22 Juil 2022
Modifié(e) : Fangjun Jiang le 28 Avr 2023
This is the cause and it shocked me.
The "Ts" is currently of data type "single". Change it to be "double".

Walter Roberson
Walter Roberson le 23 Juil 2022
Déplacé(e) : Joel Van Sickel le 27 Avr 2023
specify double(Ts) as the Sample Time in the block?

Community Treasure Hunt

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

Start Hunting!

Translated by