0
$\begingroup$

I'm trying to get to grips with the relationship between a signal $x(t)$, its Fourier transform $X(F)$ and the graph representation of $t$ plotted against $|X(F)|$. I've been using Matlab to perform the calculations and plot the graphs and see if I can predict where the spike will be on the X axis for a particular signal.

Firstly I generate a vector called xaxis which contains values from 0 to 300 in steps of 1. If I generate another vector called signal by using $signal = sin(3*(xaxis/100)*2*pi)$ and plot it, it comes out as expected - the wave oscillates 9 times between 0 and 300. The Fourier transform for this wave is also straightforward - the spike on the graph of $|X(F)|$ occurs at 9, which makes sense.

If, however, I use the xaxis range $0$ to $2\pi$ in steps of $\frac{\pi}{100}$ and define signal with $signal = sin(3*xaxis)$, the signal wave clearly oscillates three times over the interval but the frequency spike does not occur at 3 - it's roughly 0.95 from what I can see. I have a feeling that I'm interpreting the X axis value of the spike incorrectly but I can't get my head around exactly how the value of 0.95 is related to the correct answer. Could anyone enlighten me?

$\endgroup$

1 Answer 1

0
$\begingroup$

The first signal $y(t) = \sin (2\pi \cdot \frac{3}{100} t)$ has a frequency of $\frac{3}{100}$, not $9$.

When using python to plot the two signals it works out just fine. I suspect you made some mistake in your Matlab code.

Two signals next to their Fourier transform

Code:

 1 # Illustrating the relationship between a signal 2 # and its Fourier transform. 3 4 from __future__ import division 5 from matplotlib import pyplot as plt 6 import numpy as np 7 8 # Sine function. 9 def f(freq): 10 return np.sin(2*np.pi*freq*t) 11 12 fig = plt.figure("A signal and its Fourier transform") 13 plt.suptitle("A signal and its Fourier transform") 14 15 # Proper spacing between subplots 16 fig.subplots_adjust(hspace=.5) 17 18 # Use of TeX 19 plt.rc('text',usetex=True) 20 plt.rc('font',family='serif') 21 22 23 # For the first signal we have steps of dt = 1 and 24 # 300 samples. 25 num_samples = 300 26 dt = 1 27 t = dt * np.arange(num_samples) 28 29 # Plot the signal. 30 fig.add_subplot(221) 31 plt.title("Frequency = $3/100$ and $dt = 1$") 32 plt.xlabel("t") 33 plt.ylabel("y(t)") 34 y = f(3./100) 35 36 plt.plot(t,y) 37 38 # Plot the Fourier transform. 39 fig.add_subplot(222) 40 plt.title("Fourier transform") 41 ft = np.fft.rfft(y) 42 frq = np.fft.rfftfreq(num_samples) 43 plt.xlabel("Frequency") 44 plt.ylabel("Amplitude") 45 46 plt.plot(frq,abs(ft)) 47 48 # For the second signal we have steps of dt = pi/100 49 # and 100 samples, to get an interval from 0 to 2 pi. 50 num_samples = 100 51 dt = np.pi/100 52 t = dt * np.arange(num_samples) 53 54 # Plot the signal. 55 fig.add_subplot(223) 56 plt.title(r"Frequency =$3$ and $dt=\pi/100$") 57 plt.xlabel("t") 58 plt.ylabel("y(t)") 59 y = f(3) 60 plt.plot(t,y) 61 62 # Plot the Fourier transform. 63 fig.add_subplot(224) 64 plt.title("Fourier transform") 65 ft = np.fft.rfft(y) 66 frq = np.fft.rfftfreq(num_samples,d=np.pi/100) 67 plt.xlabel("Frequency") 68 plt.ylabel("Amplitude") 69 plt.plot(frq,abs(ft)) 70 71 plt.show() 72 
$\endgroup$
1
  • $\begingroup$ Perhaps I'm getting mixed up with the addition of time - the module Fourier transforms are being taught in is to do with signal processing, so a lot of the time things like period are defined relative to time. $\endgroup$ Commented Jun 9, 2014 at 13:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.