Wednesday, July 2, 2008

Activity 5



The code for getting the Fourier transform of a signal is given below:
//Generate 1-D sinusoid of form sin(2*pif*t)
T = 2;//total time interval
N = 256;//number of samples
dt = T/N;//sampling interval
t = [0:dt:(N-1)*dt];
f = 5;//frequency
y = sin(2*%pi*f*t);
f1 = scf(1); plot(t,y);

//FT of the signal and computation of frequency scale.
FY = fft(y);
F = 1/(2*dt);//max frequency
df = 2*F/256;//discrete frequency
f = [-(df*(N/2)):df:df*(N/2 -1)];

//shifted FFT output with frequency axis
f2 = scf(2);
plot(f, fftshift(abs(FY)));

Using this code results to the images below which shows the sinusoidal signal and the plot of the Fourier transform of the signal.


T=256; N =2



Answers to questions:



4. In the case of images, 2-D Discrete Fourier Transform(DFT) will be used and is given by the formula:


Applying DFT will decompose the image to its sinusoidal components. Note that the Image should be in grayscale.


5.


a) The threshold sampling interval can be found by using the formula:

Fmax = 1/(2*dT)
where Fmax is equal to 120 Hz and dT is the threshold sampling interval.
This results to a thresholding sampling interval equal to 0.0041667

b) Increasing the number of samples N results to a higher peak as shown below.
N = 512; T = 4



c) Decreasing sampling interval dt results to a smaller interval between the peaks.
N = 256; T = 1
d) Increasing the number of samples N while fixing the total time interval T results to a higher peak but interval between them is the same with the original.
N =512; T = 2
Acknowledgement: Jorge Presto

Grade: 10/10 - Activity was done and questions were all answered.

No comments: