Detect spikes and mark times
이전 댓글 표시
Hi.

I am trying to detect a spike in simulink for a signal (by spike I mean when the signal exceeds a certain value with a defined height). Futhermore, because I want to do an integration of this spike I need to have the two time values. Does anybody know how this can be achieved in matlab?
Thank you very much, Angel
답변 (1개)
Sebastian Castro
2014년 6월 5일
0 개 추천
You can pick out the values of these spikes using a Triggered Subsystem.
What I've done in the screenshot below is:
- Use a Compare to Constant block to create a logical signal. This tells me whether or not the signal is above the spike
- Use a Triggered Subsystem that, when triggered, picks the current simulation time. This time is supplied with a Clock block.
- To pick out t1, you can configure your Triggered Subsystem to find the RISING EDGE (i.e. when the logical signal goes from 0 to 1).
- To pick out t2, you can configure another Triggered Subsystem to find the FALLING EDGE (i.e. when the logical signal goes from 1 to 0).
If you have multiple peaks in your signal, your algorithm may have to be a little "smarter" than this. However, this should give a good start for how you can use Triggered Subsystems to capture "snapshots" in your model.

댓글 수: 1
Image Analyst
2014년 6월 7일
Angelos's "Answer" moved here since it's really a reply to Sebastian, not an answer to the original question:
Thank you very much.
Angelos, you can "thank" him also by accepting his answer and voting for it.
카테고리
도움말 센터 및 File Exchange에서 Electrophysiology에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!