[Simulink] How to write Values to Workspace when a Zero Crossing Occurs

조회 수: 2 (최근 30일)
Rob Child
Rob Child 2017년 3월 8일
답변: Bo Yuan 2017년 8월 3일
I have a "continuous" simulation of an object falling into the sea. My customer wants output of ~80 parameters at (say) 0.1 second timesteps, including the timestep AFTER impact. - Which I have successfully done by writing to the workspace with the sample time =0.1, AND a memory block followed by a zero crossing detection in the downs direction to terminate ~0.1 seconds late. HOWEVER, my customer understandably also wants to know the ~80 parameters at the moment of surface impact, even though this is between the timesteps, which I could do by stopping at the sea surface crossing. So far I can see how to do one or the other, but not both in the same simulation. Suggestions? I don't mind having to rearrange the rows of data in Matlab, but I can't see how to extract the additional data at just the zero crossing, and the run time is bad enough without having to run at milliseconds then decimating. I'm new to Simulink, and have not yet tried any blocks that only activate on an "event", except the Stop event. Thanks

답변 (1개)

Bo Yuan
Bo Yuan 2017년 8월 3일
Based on my understanding, you are looking to log simulation data at the zero crossing point including the minor steps of integration. You can refer to this link and try this block for minor step logging.

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by