Exercises : Week 1 Part 1 : Fourier Transforms and Matlab The purpose of these exercises is to gain some experience deriving Fourier Transforms analytically, and using Matlab *** The following are NOT formally assessed, but may be discussed in *** *** practicals and/or lectures *** 1. Derive the Fourier Transform pairs of the functions given in lectures In Matlab it is possible to verify that kind of calculations using the "symbolic math toolbox". With this toolbox it is possible to define symbolic parameters and to calculate analytical expressions for the Fourier transformation. General information about the functions in this toolbox can be found on the following URL: "http://www-ccs.ucsd.edu/matlab/toolbox/symbolic/symbmath.html" By using the command "syms" a letter can be set as a symbolic parameter e.g. >>syms x; Now the commands "fourier" or "ifourier" can be used to calculate the Fourier or inverse fourier transformation of a function containing the parameter "x". e.g. >>fourier(sin(x)) will return an analytical expression for the Fourier transformation of the sine function. 2. Write Matlab definitions for the functions in the temporal domain, sample these functions into a list, and use 'fft' from Matlab to get the Fourier domain results. Plot these functions and explain any differences from that expected in part 1. Note : the results of the fft will be a list of _complex_ numbers. Try plotting, abs(), real(), imag(), and ang(), and explain the results. what happens if you "shift" the original data, starting the sampling at a different point in time, but using the same period ? 3. Similarly write Matlab definitions for the functions in the Fourier domain and use the iftt function in Matlab to get the temporal domain results. Part 2 : Discrete Fourier Transforms The purpose of these exercises is to gain some experience plotting Fourier Transforms in Matlab *** The following are NOT formally assessed, but may be discussed in *** *** practicals and/or lectures *** 4. Consider a function func(t) that is periodic with period T. To plot this function you need to create range and suitable sampling If you have N samples then the interval between them is T/N. t = [0:T/N:T]; f = func(t); plot(t,f); Since the function is periodic, the value at 0 and T are the same, and it turns out to cause problems in the discrete Fourier Transform (DFT) if the repeated point is included. So we prefer to do this t = [0:T/N:T-T/N]; f = func(t); plot(t,f); If you want to see the function repeated explicitly, you can extend the time range : tlong = [0:T/N:3*T-T/N]; plot(tlong,func(tlong); 5. Now you can take the discrete Fourier Transform of the sampled function ff = fft(f); This list is (generally) of complex numbers. We began with a list of N numbers, f, and we got a new list of N complex numbers, ff. Note 1: Although complex numbers have two parts, (real and imaginary) we did not add any extra information. This is because ff appears in _conjugate pairs_. If you examine it you will find that (for example) ff(2) is the complex conjugate of ff(N). Note 2: There is nothing special about the choice N, but it turns out that the fft algorithm is faster when the number is a power of 2 . Choose something like N = 128 to begin with. In order to plot the list ff, we need to know the frequency range. Recall that the fundamental frequency is w0 = 2*pi/T. The range goes equally from negative frequencies to positive frequencies, and must have N numbers. We can get it like this w = [-(N-1)*pi/T:2*pi/T:N*pi/T]; We must plot the real and imaginary parts seperately. We can use colours for this figure; plot(w,real(ff),'b'); hold; plot(w,imag(ff,'r'); hold; Try doing this with functions such as Cos, Sin and others that you have been shown.