Fourier Transform : Analysis of 2 different signals

In summary: Anyway, I think what I should have said is that the bandwidth of a sampled signal is always finite, evan when the original signal has infinite bandwidth. In this case, the original signal is just a mathematical function, so it doesn't really have a bandwidth in the same sense as a real-world signal. But when we sample it and take an FFT, the resulting spectrum will have a finite bandwidth determined by the sampling rate and the length of the sampled data. So I think we're actually in agreement about this, just using different terminology.In summary, the conversation discusses the Fourier transform of a signal consisting of two sine waves with different frequencies. The expected result would be two sharp peaks at the frequencies of the sine waves. However,
  • #1
!kx!
58
0
Hi,

I was wondering what would the Fourier transform of a signal like below give:

s(t) = sin(2πt*10) ; t in [0s,5s]
= sin(2πt*20) ; t in [5s,10s]

I certainly did not expect it to give me 2 sharp peaks at frequencies 10Hz and 20Hz - because I understand that the addition of sine waves of frequencies obtained from Fourier Transform will give me original signal - so I'd expect to see two sharp peaks (at 10Hz and 20Hz) for something like...

r(t) = sin(2πt*10) + sin(2πt*20) ; t in [0s,10s]

I did a fast Fourier transform [using Matlab fft] of the above two signals.. and I obtained more or less the same peak frequencies in both : 10Hz, 20Hz. In the fft(s)There are some other low frequency components, which have considerably low amplitudes than above two frequencies.

Am I missing something? Or those low amplitude frequency components are all that are required to change s(t) into r(t)?
 
Physics news on Phys.org
  • #2
The original signal consists of alternate 5s bursts of 10Hz and 20Hz - that could be looked upon as 0.1Hz square wave AM of each of two 'carrier' frequencies. If you look at the FT of each of these in turn, you'd expect a fundamental and a 'comb' of sidebands, at +-0.1Hz,+-0.3Hz, +-0.5Hz etc (odd harmonics of the square wave) , I think. The amplitude of the first sideband would be 1/2 that of the carrier and, thereafter, the amplitudes would follow a sinx/x amplitude distribution.

Whether you use both frequencies or just one, I would have expected that you'd get the same sideband structure around each carrier. If you aren't getting it then I wonder if your input data is, in fact, what you think it is. Just a suggestion - it's always worth checking.
 
  • #3
sophiecentaur said:
If you aren't getting it then I wonder if your input data is, in fact, what you think it is.

The OP didn't say what was the sampling rate for the FFT's. A (fairly low) sampling rate chosen to show the peaks at 10 and 20 Hz might not have enough resolution to show the sidebands clearly.
 
  • #4
AlephZero said:
The OP didn't say what was the sampling rate for the FFT's. A (fairly low) sampling rate chosen to show the peaks at 10 and 20 Hz might not have enough resolution to show the sidebands clearly.

How would the sampling rate affect the displayed sidebands; isn't that down to the repeat rate, which would seem to have been 10s? The sampling rate is only relevant when under-sampling a 'real' signal, which generates aliases. I'm assuming that the samples would be specified to sufficient (floating point number) accuracy.
 
  • #5
If you have sidebands with a spacing of exactly 0.1 Hz, but the frequency resolution of the FFT is not an exact sub multiple of 0.1 Hz (and it won't be, if you take ##2^n## samples in 10 seconds), something's got to give somewhere.

The more sample points you take, the closer the FFT will be to the "exact" sideband spectrum.

Of course there is no reason why you can't take say 1000 sample points rather than 1024. A good FFT routine will work efficiently for any number of points that can be factored competely into small prime numbers (like 2 and 5) - it doesn't have to be an exact poiwer of 2. (And for doing just one FFT on 1000 points, efficiency doesn't really matter anyway on a modern PC).
 
  • #6
So where does this leave us? It seems to me very unlikely that there is anything to account for the complete (absence) of these square wave mod sidebands - even if there may be some slight error in the levels produced by the FT. Even if the 20Hz waveform were to be represented as crudely as 1010etc1010000etc0000001010101etc0101000000etc00000 (i.e. bursts of 20Hz square wave and equal periods of zero) and the 10Hz waveform were represented by 110011etc00110000000000etc000000110011001etc1001100100000etc00000 (bursts of 10Hz square wave), the FT should still throw up two carriers and two sets of sidebands. If there were 'round numbers' of cycles, to add up to 100, or 1000 or 10000, the resulting FT would have no 'errors', I think.
 
  • #7
The signal defined by the OP's mathematical function has infinite bandwidth. If you sample it and take an FFT of the sampled data, the sampled data has a finite bandwidth.

Ususally the difference isn't very important, but strange things can happen.

But I agrree, I would expect to see some sort of sideband pattern, unless the OP is plotting the data in a misleading way somehow.
 
  • #8
AlephZero said:
The signal defined by the OP's mathematical function has infinite bandwidth. If you sample it and take an FFT of the sampled data, the sampled data has a finite bandwidth.

Ususally the difference isn't very important, but strange things can happen.

But I agrree, I would expect to see some sort of sideband pattern, unless the OP is plotting the data in a misleading way somehow.

I don't think you can say that. Is not the bandwidth of a series of samples actually infinite, whether they are impulses or box-car? The sidebands associated with the square wave modulation will mostly be very much in-band and should appear as such after the DFT. The mathematical operation of the DFT 'assumes' a limited range of frequencies, the (implied) range is imposed by the sample interval / sampling rate. If the signal were to be sampled at a very much higher frequency, the difference would only be slight and would, I think, just be in the form of the higher harmonics (and their alias products) of the two carriers. Your "strange things" would, surely, be very low order; you can't fool the Maths.
Actually, we may be in agreement about this and it could be just the way we are each putting it.
However, as you say, it's possible that the output result may be plotted / displayed wrongly. It would be of interest if, as I suggested, just 20Hz and 10Hz signals were analysed separately.
 
  • #9
sophiecentaur said:
I don't think you can say that.

Mr Nyquist said it before I did.

Without getting into the math (which should be in any good reference on Fourier analysis or digital signal processsing), the basic reason is that you can't represent an arbitrary infinite-bandwidth signal with only a finite number of Fourier coefficients.

For sampled data, each sample point doesn't correspond to a delta function, but a ##A\sin(kt)/t## function which = ##A## when ##t = 0## and ##k## depends on the sample rate, to make the function zero at all the other sample points.

Uusally all the "iwggles" average out to give a smooth looking function, but not necessarily.
 
  • #10
AlephZero said:
Mr Nyquist said it before I did.

Without getting into the math (which should be in any good reference on Fourier analysis or digital signal processsing), the basic reason is that you can't represent an arbitrary infinite-bandwidth signal with only a finte number of Fourier coefficients.

For sampled data, each sample point doesn't correspond to a delta function, but a ##A\sin(kt)/t## function which = ##A## when ##t = 0## and ##k## depends on the sample rate, to make the finction zero at all the other sample points.

Uusally all the "iwggles" average out to give a smooth looking function, but not necessarily.
I agree that the frequency domain description of a time varying function cannot give any information about frequencies which are outside its range but we are dealing with frequencies that are very much inside its range. But a string of samples of a waveform will have wide / infinite frequency spectrum. The theory behind the sampling of an original continuous function is not really relevant here because the samples are already defined / artificially produced.
The OP is starting with a series of mathematically defined samples, which represent the amplitude at a given set of instants - impulse samples, which say nothing at all about the values of the signal at intermediate times. It does not imply boxcar samples - or any other arbitrary transition between the values. Nyquist filtering before sampling ensures that the samples follow the rule you stated. There are only practical reasons for using boxcar sampling (which contributes to the low pass (Nyquist) filtering).
Your sinx/x function is only relevant for boxcar sampling and is just an added complication affecting the original production of the numerical samples.
But I don't think any of this is relevant to the lack of sidebands - just, possibly to small details in their amplitudes.
 
  • #11
sophiecentaur said:
Whether you use both frequencies or just one, I would have expected that you'd get the same sideband structure around each carrier. If you aren't getting it then I wonder if your input data is, in fact, what you think it is. Just a suggestion - it's always worth checking.

Do you mean that if I do a Fourier transform of a single 10Hz signal, still I'd get sidebands? Why is that?

Here is the information about my plots.

Using Matlab, I defined a 10Hz signal as :
Ft=sin(2*pi*[0:0.001:5]*10)
That is 1000 samples per second.

On plotting the function abs(fft(Fx)), I got a single peak without any significant sidebands.

The original signals that I plotted were the fft of:
Rt = sin(2*pi*[0:0.001:10]*10) + sin(2*pi*[0:0.001:10]*20)
and,
St = [sin(2*pi*[0:0.001:4.976]*10),sin(2*pi*[0.039:0.001:5.063]*20)]

(the weird numbers for St above, are because I tried to match the minima of the two sine-waves at the point of contact, and further trimming the whole signal to 10s).

The fft for Rt above gave two peaks, much similar to that in case of Ft.
For St, there are a number of small wiggles around two significant peaks.
 
  • #12
Did you not take my point about the fact that there is square wave AM of each sinusoid involved? I suggest you look up Frequency Shift Keying to see what I mean. This is another way of looking at things.
 
  • #13
sophiecentaur said:
The theory behind the sampling of an original continuous function is not really relevant here because the samples are already defined / artificially produced.
The OP is starting with a series of mathematically defined samples, which represent the amplitude at a given set of instants - impulse samples, which say nothing at all about the values of the signal at intermediate times. It does not imply boxcar samples - or any other arbitrary transition between the values. Nyquist filtering before sampling ensures that the samples follow the rule you stated. There are only practical reasons for using boxcar sampling (which contributes to the low pass (Nyquist) filtering).
I'm going to disagree with your logic, independent of whether your conclusions are right or not.

A set of sampled data is just a list of numbers. The numbers don't "know" what the person who created them thinks they are supposed to represent - data from a contunious mathematical function, impulses, boxcar samples, or whatever.

The simple way to see that you "should" get sidebands here is to think about continuous signals, not sampled data. You are multiplying a sine wave by a square wave, you know the Fourier series for both of the above, and you know that ##\sin(at)\sin(bt) = (1/2)(\cos(a-b)t - \cos(a+b)t)##, etc.

But the OP made a plot by doing something completely different from that! If the results are different, then excluding blunders like typos etc, the explanation must be the difference between the continuous functions and the sampled data.
 
Last edited:
  • #14
!kx! said:
The original signals that I plotted were the fft of:
Rt = sin(2*pi*[0:0.001:10]*10) + sin(2*pi*[0:0.001:10]*20)
and,
St = [sin(2*pi*[0:0.001:4.976]*10),sin(2*pi*[0.039:0.001:5.063]*20)]

(the weird numbers for St above, are because I tried to match the minima of the two sine-waves at the point of contact, and further trimming the whole signal to 10s).

The fft for Rt above gave two peaks, much similar to that in case of Ft.
For St, there are a number of small wiggles around two significant peaks.

Rt is just the sum of two sine waves, not 5 seconds of one frequency followed by 5 seconds of a different frequency. So you would expect to get two peaks and nothing else.

I'm not quite sure where the "weird numbers" came from, but St is more like the function you defined in your OP, and apparently you did get some sidebands in the FFT.

FWIW defining
St = [sin(2*pi*[0:0.001:4.9999]*10),sin(2*pi*[5:0.001:10]*20)]
should work. The 4.9999 is to make sure you don't get two samples at t = 5 sec, one from each part of the definition.
 
  • #15
s(t) = sin(2πt*10) ; t in [0s,5s]
= sin(2πt*20) ; t in [5s,10s]
doesn't appear to be the same as
St = [sin(2*pi*[0:0.001:4.976]*10),sin(2*pi*[0.039:0.001:5.063]*20)]
as that expression seems to have both signals 'on' for more or less all the time. (If the notation is how it appears to be; I am not exactly sure what the convention is.)

but AlephZero's
St = [sin(2*pi*[0:0.001:4.9999]*10),sin(2*pi*[5:0.001:10]*20)]
looks far more like your original. can you actually plot your time domain signal as defined in the two different ways? Does it acgtually look like what you want?
I think it may have been a case of GIGO :smile:, which should be reassuring because nothing has shaken the foundations of accepted theory.

@AlephZero
I think we must be looking at this from different viewpoints. We both have the same textbook information about sampling theory but I think you are basing your thinking in terms of starting with a real input signal - which the OP is not.
A sample is a sample -i.e. the value of a variable at a particular time. Samples do not interfere with each other or contribute to other values unless some inappropriate filter makes it happen. This is the advantage of dealing with impulses. The calculated samples are just what they say they are (but, of course, there are a million different real input signals that could produce those same samples if Nyquist filtering is not used) and theory says that you can generate a perfect version of a sampled (low-pass filtered) signal as long as your filter has a Sinc characteristic when you re-constitute. But this is not relevant because it's a simulation. So, as we are looking for very much in-band products, I see no reason why they should not turn up just as expected. The carriers are well separated so the sidebands of each would not be expected to affect each other noticeably as they have dropped off in level by the time they start to overlap. You might expect something different if the two carriers were only 0.1Hz apart.
 
  • #16
AlephZero said:
I'm not quite sure where the "weird numbers" came from, but St is more like the function you defined in your OP, and apparently you did get some sidebands in the FFT.

I defined it the way I did.. so that it remains differentiable over whole period of 10s.. maybe that was not needed.


If you read my first post.. I just wanted to confirm that the sidebands I am getting are all that is needed to change Rt into St. I had expected transform of Rt to be just two peaks.. but I also expected the transform of St to be more diffuse (and complicated).. rather than having two sharp peaks, with just a few (that too, very small magnitude) sidebands.
 
  • #17
sophiecentaur said:
s(t) = sin(2πt*10) ; t in [0s,5s]
= sin(2πt*20) ; t in [5s,10s]
doesn't appear to be the same as

St = [sin(2*pi*[0:0.001:4.976]*10),sin(2*pi*[0.039:0.001:5.063]*20)]

as that expression seems to have both signals 'on' for more or less all the time. (If the notation is how it appears to be; I am not exactly sure what the convention is.)

The way it works in Matlab, above definition of St will concatenate the two arrays. So we will get roughly (4977+5063-38) 10,000 samples for the entire duration of 10s. (I further trimmed it to be of exact 10000 samples).
So it is more or less like AlephZero's definition.. except that this one is differentiable at the point of contact.

@AlephZero - In your case the signal jumps at 4.999s... won't that result into some other noisy frequencies in the transform? I wasn't sure about that.. so I removed that possibility.
 
  • #18
!kx! said:
@AlephZero - In your case the signal jumps at 4.999s... won't that result into some other noisy frequencies in the transform? I wasn't sure about that.. so I removed that possibility.

You may be getting rounding errors because you are defining an array using floating point variables. (I tried to look up exactly how MATLAB does that - the documentation referred me to a technical note but the link to it on the website was broken!)

If you are not getting the exact number of poiints you expect, it would be better to write something like sin(2*pi*[0:4999]*0.001*10) etc

Then you know you will get exactly 5000 points, at the times you want.

If you were getting more than 10000 points and then truncated the array, remember the function is supposed to be periodic, so you probably introduced a glitch between the start and the end of the data while you were trying to fix the glitch in the middle.
 

What is a Fourier Transform?

A Fourier Transform is a mathematical tool used to decompose a signal into its individual frequency components. It converts a signal from its original time domain representation to a frequency domain representation.

How is a Fourier Transform used in signal analysis?

A Fourier Transform is used to analyze the frequency content of a signal. By breaking down a signal into its individual frequency components, it allows scientists to identify specific frequencies that may be important in understanding the behavior of a system or in detecting anomalies.

What is the difference between a continuous Fourier Transform and a discrete Fourier Transform?

A continuous Fourier Transform is used for signals that are continuous and infinite, while a discrete Fourier Transform is used for signals that are discrete and finite. The continuous Fourier Transform produces a continuous frequency spectrum, while the discrete Fourier Transform produces a discrete frequency spectrum.

What are the limitations of using a Fourier Transform?

One limitation of using a Fourier Transform is that it assumes the signal is periodic, which may not always be the case in practical applications. Additionally, the Fourier Transform does not provide any information about the time domain behavior of a signal, only its frequency content.

How is a Fourier Transform related to the concept of harmonics?

Harmonics are multiples of a fundamental frequency that make up a complex signal. The Fourier Transform breaks down a signal into its individual frequency components, including harmonics. This allows scientists to identify the fundamental frequency and its harmonics within a signal, providing valuable information for signal analysis.

Similar threads

  • Classical Physics
2
Replies
47
Views
2K
  • Other Physics Topics
Replies
1
Views
1K
  • Biology and Medical
Replies
6
Views
388
  • Calculus
Replies
4
Views
1K
  • General Math
Replies
12
Views
993
  • Other Physics Topics
Replies
8
Views
4K
Replies
6
Views
2K
  • Linear and Abstract Algebra
2
Replies
43
Views
5K
Replies
21
Views
2K
  • Electrical Engineering
Replies
4
Views
283
Back
Top