clear
sim('RPM_meter.slx')
N = length(time);
T(1) = time(1);
RPM(1)= 60;
for I = 2:N
    T(I)=time(I);
      if (pulsa(I)>0.5)&&(pulsa(I-1)<=0.5)
          PERIODE = T(I)-T(I-1);
          RPM(I)= 60/PERIODE;
      else
          RPM(I)= RPM(I-1);
          T(I)=T(I-1);
      end
end
subplot(211), plot(time,pulsa), grid on, ylabel('PULSA')
subplot(212), plot(time,RPM), grid on, ylabel('RPM')
