Constant block only outputs a single data point
47 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
Constant blocks in Simulink have started behaving strangely for me very suddenly. As in the title - the constant block only outputs a single data point at t=0, otherwise it does not output a value. I have tried everything I can think of short of reinstalling MATLAB. The issue occurs across all my models and doesn't seem to be affected by any settings, including the solver settings. To prove this point I have created a model containing only a constant block, scope, and workspace output. Please see the screenshots below.
I have tried replacing the constant with a step, and this doesn't produce much better results.
I am fairly sure this is a bug, since it came on so suddenly and without any real change in any of my models or settings. I'm just wondering if anybody else has had this issue or knows of a workaround. I am highly dependent on Simulink for my university course, and since this renders it basically useless I am really keen to get it sorted.
Many thanks.
7 个评论
Paul
2020-12-24
Maybe send a simple model that illustrates the problem to Tech Support and see what they say? If you do and they solve the problem or identify an issue, please post back here with the results.
回答(2 个)
Mark McBroom
2020-12-25
What is the sample time for the constant block? The default is "inf" which indicates constant sample time. Change this to -1 or 0.2 and you will see data plotted each time step. See this description of constant sample time. https://www.mathworks.com/help/simulink/ug/types-of-sample-time.html
2 个评论
Mark McBroom
2020-12-26
When a constant block has a value of "inf", Simulink only computes its output one time because it never changes during the simulation. What problem are you trying actually trying to solve? Do you have workspace parameters in your constant blocks? Are you trying to tune then during the course of a simulation and not seeing the newly tuned value take effect in your Simulink model?
sregmi
2024-7-24
I have the same issue. I am on R2024a.
The output on the scope is a single datapoint while the same output on Simulink data inspector is datapoints across the time (which is what we expect).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!