Nick Gammon Timing an interval using the input capture unit

Hello. Sorry for the bad english. I want to consult on how to measure the frequency using the input capture unit Mega328. I used the code Nick Gammon Gammon Forum : Electronics : Microprocessors : Timers and counters , reply # 12. This code works fine, but sometimes the frequency is twice higher or lower than the actual rate. This is evident in the simulator and on the device. In the graph the frequency, which is displayed through the RS232. Please help to get rid of these emissions. Thank!

Please explain what the graph shows and why there are negative pulses (which could damage an Arduino input).

The graph plots the frequency , which measures the Arduino , and sends the serial port. I use a program serial oscilloscope.