I have data from a power transformer that has a frequency of 60 hz. Sometimes there are faults in the system and causes a large spike in the reading of the transformer. What I want to do is run the data into a signal processor to detect when these large spikes occur and either remove the spike value or present the time of occurrence. how would I be able to detect this spike in Octave?
I'll assume that your data is in the form of discrete samples equispaced in time (as given by a standard analog-to-digital converter).
If the nominal signal is a clean 60Hz sine wave, I would suggest filtering out the 60Hz with a digital notch filter. This will essentially subtract the correct signal, leaving you with the noise. Then, compare the magnitude of the filter output to a threshold (which you will choose empirically) in order to detect the spikes. Note that the filter may or may not introduce a delay between the original signal and the filter output (esp, if you are doing this in realtime), which you will need to compensate in your time-of-occurrence estimate. This time compensation may also apply to the methods below.
If the nominal signal is not a clean sine wave, you can probably track the nominal frequency characteristics of the signal, e.g. using short time fourier transform, and watch for undesirable deviations from this.
You may also be able to perform a linear prediction on the signal, and detect spike noise events based on the magnitude of the prediction error signal.
These are all just suggestions, many other approaches likely exist.