0
$\begingroup$

First I defined 5 signals with same length (40 samples) with different frequency and sampling frequencies, then I've put them together like [X1 X2...] and took it's fourier transform and the result is in the corresponding figure, the I took those 5 signals with same length (200 samples) and sum the up and took it's fourier transform, the result is in the corresponding figure, what makes these two signals fourier transforms different? why is it?enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Does it even make sense to sum different signals taken at different sampling frequencies? $\endgroup$ – jithin Apr 22 '20 at 11:45
  • $\begingroup$ it probably doesn't but think as if their sampling frequencies are equal and frequencies are different, what now? why there is that difference? $\endgroup$ – Mohamad Gholizadeh Apr 22 '20 at 12:34
  • $\begingroup$ Can you provide a little more information on input signals? $\endgroup$ – jithin Apr 22 '20 at 13:07
  • $\begingroup$ Your figures appear to be the time domain signals? $\endgroup$ – Dan Boschen Apr 22 '20 at 18:59
1
$\begingroup$

If I understand correctly, the OP is comparing cascading 5 time domain signals one after the other as in $[f_1, f_2, f_3, f_4, f_5]$ and taking the DFT to summing longer samples of the signals and then taking the DFT. The following is what we would expect to see in this case.

The DFT of the sum of functions is equal to the sum of their DFT's:

$$\sum_{n=0}^{N-1}f_1(n)W_N^{nk}+\sum_{n=0}^{N-1}f_2(n)W_N^{nk} = \sum_{n=0}^{N-1}(f_1(n)+f_2(n))W_N^{nk}$$

Consider first all sequences of the same length and cascading versus summing the sequences:

Cascading $R$ sequences of equal length $M$ is identical to zero-padding each of the sequences out to $N = RM$, each with starting offset of $rM$ where $r$ is from $0$ to $R$.

Example with two sequences with $M=4$:

$f_1 = [1, 2, 3, 4]$

$f_2 = [6, 8, 9, 1]$

$\text{DFT}\{[1, 2, 3, 4, 6, 8, 9, 1]\}$

$ = \text{DFT}\{[1, 2, 3, 4, 0, 0, 0, 0]\} + \text{DFT}\{0,0,0,0, 6, 8, 9, 1]\}$

Zero-padding a sequence prior to taking the DFT does not change the original DFT values, but inserts new interpolated values in between the samples in frequency. Such that

$$F_p(nk) = F(k) \tag{1}\label{1}$$

Where $F$ is the DFT of a sequence $f$ and $F_p$ is the DFT of $f$ with zero-padding. This is proven below along with the fact that equation $\ref{1}$ holds true for all offsets $rM$.

So in the example with $f_1$ aand $f_2$ above, $$F[k] = \text{DFT}\{[1, 2, 3, 4, 6, 8, 9, 1]\} $$

$$F[nk] = \text{DFT}\{[1, 2, 3, 4]\} + \text{DFT}\{[6, 8, 9, 1]\}$$

Similarly, the DFT of the cascade of the five sequences would have the same values as the DFT of the sum of the five sequences with four interpolated values in between each of the DFT samples!

Since in this case the OP didn't simply sum the sequences, but rather summed longer sequences out to the same length as the cascaded sequence, then here the DFT of the longer sequences would have the higher frequency resolution and scaled 5 times larger given by the longer data set, so the values in between that were previously interpolated would now be dictated by the longer time samples as new DFT values. However every 5th sample in both sets should match exactly other than the scale of 5 for the same reason outlined above, with more samples of actual frequency data in between!


Proof of relationship used above in equation $\ref{1}$

Given sequence $f(n)$ where $f(n) = 0 \text{ for } n \notin [0, M-1]$

The DFT of $f(n)$ is: $$F(k)=\sum_{m=0}^{M-1} f(m)W_M^{mk}, \space\space\space\space k = 0,...M-1\tag{2} \label{2}$$

Where $W_M^{n}$ are the $n$ roots of unity given by $e^{-j2\pi n/N}$

The zero padded DFT of $f(n)$ out to length $N=RM$ with $R\ge 0$ with any offset $rM$ with $r \in [0, R]$ is:

$$F_P(k) = \sum_{n=0}^{N-1} f(n-rM)W_{N}^{nk}, \space\space\space\space k = 0,...N-1\tag{3} \label{3}$$

Using the DFT shift theorem, equation $\ref{3}$ becomes:

$$F_P(k) = \sum_{n=0}^{RM-1} f(n-rM)W_{RM}^{nk}=W_{RM}^{rMk}\sum_{n=0}^{RM-1} f(n)W_{RM}^{nk} $$ $$= W_{R}^{rk}\sum_{n=0}^{RM-1} f(n)W_{RM}^{nk}$$

Since $f(n) = 0$ for $n>M-1$

$$F_P(k) = W_{R}^{rk}\sum_{n=0}^{M-1} f(n)W_{RM}^{nk}\tag{4} \label{4}$$

$$F_P(Rk) = W_{R}^{rRk}\sum_{n=0}^{M-1} f(n)W_{RM}^{nRk} = \sum_{n=0}^{M-1} f(n)W_{M}^{nk} = F(k)$$

Thus we see how given any sequence $f(n)$ of length $M$ with DFT $F(k)$, zero padded out to length $N=RM$ for any positive integer $R$ with DFT $F_P(k)$, the following equality will hold for any rotational offset (starting index) of $rM$ for any integer $r$ from $0$ to $R-1$:

$$F(k) = F_p(Rk) \tag{5} \label {5}$$

$\endgroup$
0
$\begingroup$

I don't know why I get a down vote. So I briefly add a concise explanation about the results.

Because Fourier Transform holds the two properties.

  • Parseval's equality: Temporal energy equals to spectral energy

  • Linearity: f(x + a y) = f(x) + a f(y)

From the viewpoint of power, lets' assume

E(signal 1) = E(x1)+E(x2)+E(x3)+E(x4)+E(x5),

where E(.) denotes the energy of a signal. Because the length of x1 in signal 2 is only 40 samples, which is 1/5 in comparison with that (200 samples) in signal 1. So, we obtain,

E(signal 2) = E(x1)/5 + E(x2)/5 + E(x3)/5 + E(x4)/5 + E(x5)/5.

Moreover, by linearity, we know that the shape of spectrum of signal 1 and signal 2 should be similar because We didn't do any filtering. What we actually do is just alter the phase and energy.

So, FT{S2} is expected to be 1/5 x FT{S1}. The matlab simulation code confirms the results.


My results doesn't match your simulation. Please check.

enter image description here

Code:

n = 0:1/10:20-1/10;

f1 = 1;
f2 = 2;
f3 = 3;
f4 = 4;
f5 = 5;

X1 = sin(2*pi*f1*n);
X2 = sin(2*pi*f2*n);
X3 = sin(2*pi*f3*n);
X4 = sin(2*pi*f4*n);
X5 = sin(2*pi*f5*n);

signal1 = X1+X2+X3+X4+X5;
signal2 = [X1(1:40) X2(1:40) X3(1:40) X4(1:40) X5(1:40)];

freq1 = abs(fft(signal1,256));
freq2 = abs(fft(signal2,256));

figure;
subplot(2,1,1);
plot(freq1);
title('Freq of signall = X1+X2+X3+X4+X5');
subplot(2,1,2);
plot(freq2);
title('Freq. of signa12 = [X1 X2 X3 X4 X5]');

figure;
subplot(2,1,1);
plot(signal1);
title('Time domain of signal1 = X1+X2+X3+X4+X5');
subplot(2,1,2);
plot(signal2);
title('Time domain of signal2 = [X1 X2 X3 X4 X5]');
$\endgroup$
1
  • 1
    $\begingroup$ Not sure why this was down-voted Po. I looked through this to see if I could see any issue. Looks good to me - I wish people would give helpful advice when they do that so we understand the issue or concern. I upvoted to counter-balance, but not sure why you zero pad out to 256; might be clearer to not add that additional complexity? (And would help illustrate my answer). $\endgroup$ – Dan Boschen Apr 23 '20 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.