Fourier Transforms
[IMP.: Along with the plots I also want to see the programs you used]
1. Take the sinusoidal function x = 0.5*sin(1+2*pi*0.01*t) where
t=[1:1:1024]
Obtain the power spectral density (PSD = |FFT|2) of
the above function and plot the original function as well as the PSD vs
frequency and PSD vs period.
2. Take the function which is combination of two sinusoidal functions
having incommensurate frequencies
x = 0.5*sin(1+2*pi*0.01*t) + 0.5*sin(1+2*pi*sqrt(2)*0.01*t) where t=[1:1:2048]
Obtain the PSD - plot the original function as well as PSD vs
frequency and PSD vs period.
3. Now look at the effect of random noise. Add a random component =
random_strength*rand(1,2048) to the above function.
(The function rand generates uniformly distributed random numbers between
[0,1] and the parameter random_strength gives the relative magnitude of
the randomness compared to the periodic function)
Plot the function and the PSD vs frequency plots for random_strength
= 0.1, 0.5 and 1.
Note how the background intensity in the PSD plot rises with increasing
randomness.
4. Now instead of a sinusoidal function, consider a series of delta-functions
with the same frequency as the sinusoidal function in the 1st problem.
You can generate this by using the following function
>> x1=sign(x-0.99);
where x is defined in Problem 1.
But the values of this new function lie between -1 and 1. So we rescale
it to lie between 0 and 1.
>> x= 0.5*(1+x1);
Plot the original function as well as the PSD vs frequency plot
5. Now we go over to two dimensions. Design a 2-D function of diagonal
planes. One way you can do this is
>> a = zeros(100);
>> for i=1:100, for j=1:100, if mod(abs(i-j),5)==0, a(i,j)=1;end;end;end;
>> imagesc(a)
This will give you diagonal planes between (x=[1:100],y=[1:100])with
a spacing of 5 units between them.
Increase the spacing between planes to 10 and obtain the PSD.
Plot the contours of the original function as well as the PSD.
>> n=length(Y);
This gives the number of elements in Y - we need to take only half
of the total number, as the other half is simply a repetition of the first
half.
>> power = abs (Y(1:n/2)).^2;
or, equivalently.
>> power = abs(Y(1:n/2)).*abs(Y(1:n/2));
To obtain the frequency axis, note that we have to scale it by the Nyquist
frequency
When the data set is arranged according to a integer index 1,2,3,....
>> nyquist = 1/2;
>> frequency = (1:n/2)/(n/2)*nyquist;
>> plot(frequency, power)
To plot the data against the period instead of the frequency
>> period = 1./frequency;
>> plot(period, power)
Similar set of operations for two-dimensional fft using the command
fft2
See MATLAB help for further details