# How to calculate IAE between zero-crossing

조회 수: 4(최근 30일)
PAOLO OLIVIERI 2022년 8월 5일
댓글: Sam Chak 2022년 8월 8일
I am studying a load disturbance detection procedure presented by Hagglund.
Through simulink I have calculated the control error (it is an array) and I need to calculate the IAE between two consecutive istances of zero crossings as presented in the formula below In simulink I used a simulation time of 30s and a sampling period of 0.001s.
the question is: how can I calculate the IAE between each zero-crossing and, after each zero-crossing, reset the IAE to 0? Next I need to plot the obtained IAE array.

댓글을 달려면 로그인하십시오.

### 답변(1개)

Sam Chak 2022년 8월 6일
편집: Sam Chak 2022년 8월 6일
Are you looking for a MATLAB or Simulink solution?
sys = ss([0 1; -1 -1], [0; 1], [1 0], 0);
[y, t] = step(sys, 16);
e = 1 - y;
subplot(2,1,1)
plot(t, e), grid on, xlabel('t'), ylabel('e(t)'), ylim([-0.5 1.01])
ae = abs(e);
subplot(2,1,2)
plot(t, ae), grid on, xlabel('t'), ylabel('|e(t)|'), ylim([-0.5 1.01]) J_IAE = trapz(t, ae)
J_IAE = 1.7122
To reset the IAE to 0 after each zero-crossing detection, you probably need some conditional logics. By the way, what does the reset-IAE imply after each zero-crossing detection?
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Sam Chak 2022년 8월 8일
Your IAE is increasing over time. This suggests that the error is accumulating and the output did not track the reference signal.

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!