1

I have a ground-based magnetic data in txt file taken every second and I want to plot its Fourier Spectra.

And I notice the spectrogram equation on MatLab need this parameters (window, noverlap, nfft, Fs) which I don't know.

And I notice also that I should do the FFT on my data first before plot its spectrogram, but my data is not discrete and FFt for the discrete data, anyone know how I can do this?

  • window is the type of windowing option you want to use, it can be a hamming/hanning/blackman/rectangle etc. noverlap stands for number of overlaps which is usually set to 50%, nfft is the number of FFT and Fs is the sampling frequency, if you do not fully understand what these parameters mean, I suggest you google them, as they are very important for the correct output of your data ESPECIALLY because you have low sampling frequency, which may lead to spectral leakage. – GameOfThrows Aug 17 '15 at 13:39

1 Answers1

0

data is discrete by definition. spectrogram and fft give different view s of the data.

spectrogram would be appropriate for a STFT short-time Fourier transform, in case you want to look at successive, overlapping windows of time. fft is the method spectrogram will use to compute the transform.

. Fs is the sampling rate, which you say is once per second, so 1 Hz. Here is one way to view the spectrum,

Fs = 1;
X = fft(data);
N = length(data);
freq = (-N/2:N/2 - 1)*Fs/N;
XmagdB = 10*log10(X.*conj(X));
plot(freq, XmagdB)

Good luck!

  • thanks for answering. I applied your code and i got this plot ( https://www.flickr.com/photos/51475975@N07/20491245828/in/dateposted-public/ ) and i want spectrogram of the data. – Aliaa Abdelnasser Aug 18 '15 at 12:12