Strange artefact in my Fourier transform - matlab

I have performed an fft (fast fourier transform) on a time series waveform in Matlab, but I seem to have a weird wave actually in the fourier transform plot, although there are spikes this wave looks like something I'd expect to see only in the time domain. Is there any programming reason why this could happen?

The Fourier transform is quite similar to the Inverse Fourier Transform. A spike in one is a wave in the other. Hence, if you have one outlier datapoint in your series, you'll have a wave component in the frequency domain.
A possible programming-related issue could be an uninitialized data point, e.g. providing 1023 datapoints to a 1024-point FFT.

The fft assumes the signal is periodic so you can get some artefacts if the first and last values differ by enough to make that transition look like a step function. You are frequently better off windowing the data to avoid that phenomenon.

Note that the continuous-time Fourier transform of a finite-length signal can have things that look like "spikes" in the frequency domain. See the plots in this post of the continuous-time Fourier transform of a single period of a cosine signal and of ten periods of a cosine signal.
For example, an infinite extent cosine signal has a simple Fourier transform that's a pair of impulses at +/- the cosine frequency. But if you've only got ten periods of the cosine signal, the Fourier transform looks like this:

Steve's currently doing a nice series on Fourier transforms on his blog. He's specifically talking about 2D transforms, but you might find his discussion of windowing helpful.

Related

How to convert scales to frequencies in Wavelet Transform

I'm dealing with CWT, and I have a big problem converting scales to frequencies. In the MAtlab Wavelet Tutorial they use this expression to convert scales to frequencies
But if i use the default function scal2freq I obtain different result.
I don't understand the role of the Morlet Fourier Factor
Thanks in advance
It is a pretty complicated concept, which I somewhat understand it. I'll write some points here so that you might figure it out yourself, rather easier.
A simple fact is that:
Scale is inversely proportional to frequency.
For example, imagine we have a 1-100 Hz range of frequencies in some time series data such as stock markets data or earthquake data. Scale is "supposed to be" the inverse of that. For instance, if scale would be in range of 1 to 100, we'd have had:
Scale(1/Hz) Frequency (Hz)
1 100
50 50
100 1
Therefore,
The frequency is not the real frequency of those time series data (e.g., stock market, earthquake) that we know of. They are only related, inversely.
And we can safely say that here we are calculating some "pseudo-frequencies", which MATLAB does that (by approximating that). You can read about the approximation process in the documentation in the section pseudo-frequencies:
MATlAB does calculate those pseudo-frequencies based on:
In wavelet analysis, the way to relate scales to frequencies is to determine the center frequency of the wavelet function:
which you can visually see in this image and of-course it would differ, when we would change the types of our function in the calculation. Thus, that center frequency will change everytime in our approximation process:
That "MorletFourierFactor" is a variable to approximate a constant so that when you would do the 1/scale, it would closely approximate those "pseudo-frequencies".
I thought this image about shifting (time axis) and scaling (frequency axis) might be a little helpful to look into as well:
The bottom line is that don't worry about pseudo-frequencies, you wouldn't probably need those. If you would want any frequency spectrum, you can likely go towards applying some of those frequency methods (such as Fast Fourier Transform) on whatever time series data that you have.
If you really really want to map that, you can also try to design some methods to approximate it yourself.
Source
Harvard Seismology

Spectrogram after fft

I want to ask. I have my data after Fourier transformation in .mat file. I need to get a spectrogram of it.
What function I should to use in Matlab to do it?
spectrogram() function doesn't fit, because it uses signals before Fourier transformation.
Thank you a lot for any help.
Simply put, you can't. Having the Fourier Transform of the entire signal already performed does not allow you to find the spectrogram. Recall that the spectrogram finds the Fourier Transform of local windows whereas what you have found is the Fourier Transform of the entire signal. The spatial locality of the windows is already lost and so you simply can't do what you're asking.
If your data are FFT of entire the signal, you can't plot the spectrogram.
In order to get spectrogram, you have to perform Short-time fourier transform of each frame then plot it to a map.

Fourier transform and filtering the MD trajectory data instead of PCA for dimensionality reduction?

I was using PCA for dimensionality reduction of MD (molecular dynamics) trajectory data of some protein simulations. Basically my data is xyz coordinates of protein atoms which change with time (that means I have lot of frames of this xyz coordinates). The dimension of this data is something like 20000 frames of 200x3 (atoms by coordinates). I implemented PCA using princomp command in Matlab.
I was wondering if I can do FFT on my data. I have experience of doing FFT on audio signals (1D signal). Here my data has both time and space in picture. It must be theoretically possible to implement FFT on my data and then filter it using a LPF (low pass filter). But I am unsure.
Can someone give me some direction/code snippets/references towards implementing FFT on my data?
Why people are preferring PCA more often compared to FFT and filtering. Is it because of computational efficiency of algorithm or is it because of the statistical nature of underlying data?
For the first question "Can someone give me some direction/code snippets/references towards implementing FFT on my data?":
I should say fft is implemented in matlab and you do not need to implement it by your own. Also, for your case you should use fftn (fft documentation)to transform and after applying lowpass filtering by dessignfilt (design filter in matalab), the apply ifftn (inverse fft in matlab)to inverse the transform.
For the second question "Why people are preferring PCA more often compared to FFT and filtering ...":
I should say as the filtering in fft is done in signal space, after filtering you can't generalize it in time space. You can more details about this drawback in this article.
But, Fourier analysis has also some other
serious drawbacks. One of them may be that time
information is lost in transforming to the frequency
domain. When looking at a Fourier transform of a
signal, it is impossible to tell when a particular event
has taken place. If it is a stationary signal - this
drawback isn't very important. However, most
interesting signals contain numerous non-stationary or
transitory characteristics: drift, trends, abrupt changes,
and beginnings and ends of events. These
characteristics are often the most important part of the
signal, and Fourier analysis is not suitable in detecting
them.

Frequency representation using discrete wavelet transformation

I am trying to use wavelet transform to represent song in frequency domain using discrete wavelet transform to made decomposition and made the frequency of the singer in place the the song using Matlab
The problem that the dwt and the decomposition mades represent it only in time domain.
How can I represent it in frequency if DWT doesn't represent It what would do?
Thank you
When we say "frequency transform" or talk about "representing frequency" we are usually talking about the Fourier Transform, implemented as the DFT, or discrete Fourier transform. Andre is correct in the comments below when he says that the DWT is also a type of frequency transform; however, wen we say "represent song in frequency domain" it usually means DFT, not DWT.
That being said, I don't recommend the DWT for music and sound analysis because the analysis bands are fixed at one-octave, which is simply too wide to do anything meaningful with. There are other techniques related to wavelets that are more effective for audio, but I don't gather from your question that you are using one of them.
In addition to the DFT, which is usually implemented as the FFT, or fast Fourier transform, you may also want to read about the STFT (short-time Fourier transform).

Computing the short time windowed Fourier Transform

Could anyone suggest a method for computing the short time windowed fourier transform of a given signal, also known as the windowed fourier transform, of a signal with altering periodicity? Consider this example data series:
t = 1:365;
x = cos((2*pi)/12*t)+randn(size(t));
I understand the principles behind the method, but trying to implement it in matlab is another matter. I this example is not sufficient to provide an answer, any solution to a signal with varying periodicity would be much appreciated.