Using edge function as a trigger
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a very basic simulink model. Inside the function block I have the following code based on the information herehttps://uk.mathworks.com/help/physmod/simscape/lang/discrete-event-modeling.html#bu6gpnj-1
function y = fcn(u)
y = edge(u);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352397/image.png)
The second result plot does not capture the rising edge as I would expect. Would anybody be able to explain what I am doing wrong?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352400/image.png)
댓글 수: 0
답변 (1개)
Ayush Gupta
2020년 9월 9일
The documentation page about discrete event modeling is for Simscape code. It is not MATLAB code and cannot be used in a MATLAB function block. A possible workaround for edge triggering block would be to use the Edge Detector block in Simulink.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!