# Analyzing Spectrum of a signal?

my_signal = 8192*cos(2*pi*6*(0:7)/8) + 1i* 8192*sin(2*pi*6*(0:7)/8);

my_signal_fft = fft(my_signal);

plot(abs(my_signal_fft));


This is matlab code. What do you notice about the spectrum? Is it symmetrical? Obviously not, because I think it has an imaginary part. Would you enlighten me for the analysis of this signal's spectrum and why having an imaginary part doesn't make it symmetrical? How is the other half gone?

• There are a lot of questions here. Would it be correct to summarize by asking "Why does an imaginary component result in an asymmetrical spectrum?" May 13 '14 at 12:35

$$x(n)=A[\cos(2\pi fn)+i\sin(2\pi fn)]=Ae^{i2\pi fn}$$

This is a complex exponential with normalized frequency $f$ (normalized by the sampling frequency). The bins of the signal's FFT of length $N$ correspond to normalized frequencies

$$f_i=\frac{i-1}{N},\quad i=1,2,\ldots, N$$

In your case $N=8$ and $f=6/8=f_7$ (using the Matlab indexation, which starts with index $1$). So the frequency of your signal $x(n)$ lies exactly on the FFT grid. This is why there is one peak at index $7$ and all other values are $0$ (apart from numerical inaccuracies).

If $x(n)$ were real-valued, its FFT would satisfy the following symmetry condition:

$$X_k=X^*_{N-k}$$

However, for complex-valued signals, such as yours, there is in general no symmetry.

• I'm sorry I'm a noob in dsp yet, can you please elaborate "The bins of the signal" and "So the frequency of your signal x(n) lies exactly on the FFT grid." where else it can lie, what is meant with FFT grid? May 13 '14 at 12:53
• @Anarkie: The bins of the FFT are simply the values of the FFT. You have 8 bins and each bin corresponds to a certain frequency given by the formula in my answer. The frequency of your complex exponential could be anywhere between two bins, but it so happens that it exactly corresponds to one of the bin frequencies. So you see exactly one nice peak at this particular FFT bin. May 13 '14 at 12:55
• – jojek
May 13 '14 at 12:56
• @MattL. Sorry for the late response, I understand fi calculation but just don't understand why the peak is at 6/8 index 7, why not 2/8, why not 5/8? May 25 '14 at 19:43
• @Anarkie: Simply because in the argument of your sine and cosine functions you have 2*pi*(0:7)*6/8, so 6/8 is the relative frequency. And because Matlab's indices start with 1, not with 0, the corresponding FFT index is not 6 but 7. May 25 '14 at 19:50