Controlling output from Simulink
이전 댓글 표시
Hi all
My simulink is running at a fixed time step of 0.1 and i need my block to produce output at alternate time like 0,0.2,0.4,etc
Can GetTimeOfNextVarHit of lvl 1 S-function block fulfil this requirement?
If not how should i do it?
답변 (3개)
Kaustubha Govind
2011년 3월 8일
1 개 추천
Why not set the S-function sample time to 2*ssGetFixedStepSize(S) in mdlInitializeSampleTimes? You might also want to protect your code using ssIsVariableStepSolver to ensure that a variable-step solver isn't being used.
댓글 수: 2
Tan Edwin
2011년 3월 9일
Kaustubha Govind
2011년 3월 11일
Try str2num(get_param(bdroot,'FixedStep'))
Andreas Goser
2011년 3월 8일
0 개 추천
Check out the menu:
Simulation -> Configuration Parameters -> Data Import/Export
In your example, you could just enter a decimation of 2. But you have also other option, see the pull-down "Output options". You can e.g. produce additional output.
Paulo Silva
2011년 3월 8일
Try with the matlab Fcn block
out=u(1) %or out=u
It will put the value in the block input to the variable out in the matlab workspace, that way you can share data with other models, do the same thing to get data from the workspace
out %the value of out will be the output of the Fcn block
And maybe putting 0.2 on the matlab Fcn sample time will only update or get the out value each 0.2 seconds.
댓글 수: 2
Tan Edwin
2011년 3월 8일
Paulo Silva
2011년 3월 8일
the code that you put in your matlab fcn block are just like the ones you execute in the command line, same memory area.
카테고리
도움말 센터 및 File Exchange에서 Create MATLAB S-Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!