# How Discrete sequence could have more than one Frequency

I'm trying to understand Fast Fourier Transform in Detail to find out what exactly the frequencies when dealing with discrete sequence,

Here is what I've done,

First I've taken a Sinusoidal wave with 1Hz Frequency

A = 4;       %Amplitude

Fs = 8;      %Sampling Frequency 8Hertz
Ts = 1/Fs;   %Sampling Rate = 0.125

f = 1;       %Frequency of Wave = 1Hz
t = 1/f;     %Time period = 1 Second

n = 0:Ts:(t);  %{0,0.125,0.250,0.375,0.500,0.625,0.750,0.875,0.100}

x=A*sin(2*pi*f*n);


Now, If I plot it,

subplot(2,1 ,1);
plot(n,x); The values of the sampled points are , Generated Sample's Amplitudes = {0,3,4,3,0,-3,-4,-3,0}

% Sinewave Period = (Samples/Period)*(Time/Sample)
% Sinewave Period = (8)*(0.125)
% Sinewave Period = 1sec
% Reciprocal of 1sec => 1Hz <-- Original Frequency


Now let's take its FFT by manually giving discrete sequence as input,

FFT divides your Sampling frequency into N equal parts and returns the strength of the signal at each of these frequency levels. What it means is you are dividing frequencies from 0 to 8(Fs) into 8(No.of Samples) equal parts.

F = fft([0 3 4 3 0 -3 -4 -3 0]); and this is true.

But what if I take the FFT of completely Random Sequence, like,

fft([40 2 8 31 6 8 -4]);


Have a look at its Frequency Plot, I've reading a book and found,

Sinewave Period = (Samples/Period)*(Time/Sample) Freqeuncy = 1/Sinewave Period

In Random sequence I mentioned above have total of 7 samples, but What it its period ? What it is the time between each Sample in this signal since it is totally random ? How could this sequence represents more than 1 frequency ?

• If you have a random sequence, it doesn't have a period. The DFT knows nothing about the source of your data; it is just a list of numbers. The transform outputs are just a measure of how well the input vector correlates with complex exponential functions at uniformly-spaced frequencies across the Nyquist region. Feb 27, 2013 at 13:47
• You have $9$ equally spaced samples of a sinusoid of frequency $1$ Hz. Are you doing a $9$-point FFT? See this answer to understand why you need $8$ samples, not $9$, and a $8$-point FFT. Feb 27, 2013 at 14:42
• If you want a "perfect" FFT output, your last sample should not be the same as the first sample. Your signal has to be cyclic, meaning the first sample would come after the last sample in a cycle. Feb 27, 2013 at 15:06

Not trying to be negative, but your questions don't make much sense.

Q1: In Random sequence I mentioned above have total of 7 samples, but What it its period ?

A1: There is no period of a random sequence. If something is periodic, there will be repeated sections. If you know a section will be repeated, that is not thought of as random.

Q2: What it is the time between each Sample in this signal since it is totally random ?

A2: The time between each sample is Ts. randn(7,1) has no sample rate. If you want it to represent 7 random numbers sampled at 8Hz, then the time between each sample is 1/8 seconds.

Q3: How could this sequence represents more than 1 frequency ?

A3: With out going in to examples, a random sequence, by definition must represent more than one frequency. Anything that is not a single sinusoid will represent more than one frequency.

The plots are helpful in explaining the scenario, but you may want to revise your questions.

When you are working with discrete sequences, frequency really becomes a different concept that "real world" frequency. You can use analogy to relate information from discrete analysis back to the real world, but the two worlds are different.

First, once you have converted a real time / continuous signal to a discrete version, you immediately change the data representation such that no frequencies above 1/2 the sampling rate can be represented.

Second, the concept of frequency in the discrete world, with regard to the FFT, is based on the Discrete Fourier Transform (DFT). The DFT imposes a restriction on your analysis. The DFT assumes that all data is periodic. The longest period represented in the transform is based on the length of samples being analyzed. The representation says that your data is composed of a finite number of evenly spaced (in frequency) periodic sequences. The set of periodic sequences are thought of as frequency bins. The number of frequency bins is equal to to the length of the data. So if you have say 8 samples your are working with, there are 8 frequency bins. Half of the frequency bins are "reflections" of each other (represent the same frequency) so you are now down to 4 bins. Two bins fall into the DC component, so you are left with 3 periodic sequences to represent your data. So in terms of the original random signal you are analyzing, by doing an FFT analysis, you converted the signal from random to a band limited periodic signal composed of a finite number of frequencies. This is very different from a real world random signal.

In your specific case, where you have computed fft([40 2 8 31 6 8 -4]), I don't know the mechanics of the specific FFT algorithm, but it looks like the data has been padded up to 8 samples, so you have a DC component and 3 additional periodic sequences. Notice that the values ranging from 2 to 7 are symmetric around 4.5, so your periodic sequences are for frequencies represented by bins 2, 3 and 4 (5 is a reflection of 4, 6 is a reflection of 3 and 7 is a reflection of 2). Bin 1 would be considered the period of the overall sequence.

You have to consider the sampling rate to convert the bins back to real frequencies:

bin# * SampleRate / NumberOfBins

• Now why would someone vote down a legitimate answer to a question. You would think they would have the courtesy to comment instead. Feb 27, 2013 at 23:20
• @Bruce, yes, courtesy is sometimes lacking here unfortunately. :-/ Yes, it would be nice on whoever downvotes to at least mention or comment. Cest la vie I suppose. Mar 2, 2013 at 1:31
• @Mohammad, Yes Cest la vie. People should realize this is a site that runs on good faith. Fortunately a lot of users do have a reasonable understanding of etiquite. Interestingly, I noticed today that I am only a 25% trusted user. Must take a lot of good faith to be 100% trusted :-) Mar 4, 2013 at 15:18
• @ BZ, it appears as though the OP downvoted your post in this instance. I am not sure why... Mar 4, 2013 at 17:24