Accuracy of sampling rate

I have data corresponding to 300 seconds. Sampling rate is 500Hz. I should have 500*300 = 150000 samples. But due to hardware error, I am receiving a few extra samples. What is the optimal way of removing extra samples obtained to reduce the data to 150000 samples. I can't use all of the samples because data obtained contains many events which are synchronized in time.

• What are you doing with the data? Many applications aren't particularly sensitive to the sample rate being right on the money. If you application is, you may need to resample it to the correct sample rate. Also, are the samples that you do have taken at uniform intervals? – Jason R Jul 27 '16 at 13:19
• Do you have an accurate record of the time-stamps for each sample, or do you know the exact time interval between each sample? If you do, the optimal way to re-sample to uniformly spaced time instants is via interpolation. If you don't, then my guess is that a semi-optimal solution would be to re-sample from an average uniform rate to the desired rate, as suggested above (also using interpolation, but with erroneous offsets in the time-instants)... [In some applications, the non-uniform sampling is called 'jitter', and it can cause unwanted modulation.] – Arnfinn Jul 27 '16 at 13:36
• doe these few extra samples just mean that sampling didn't stop after exactly 300 seconds, or do you really have a sampling rate mismatch of $1+\frac{\text{a few}}{150000}$? – Marcus Müller Jul 27 '16 at 15:01
• . . . or does the hardware throw in an occasional "extra" sample? Or are samples occasionally duplicated? Are the extra samples at all useful? We need to know the nature of your "hardware error" in order to know how to compensate. – Mark Jul 27 '16 at 23:05
• Yes, the samples are taken at a uniform rate. The problem is that I don't know the exact time instants at which extra samples are introduced so that i can interpolate samples at that time instant. Is it okay to randomly interpolate samples? – Anoop Bhushan Jul 28 '16 at 5:28