Thursday, July 3, 2008

A5-Physical Measurements from DFT

Below is the sample code of the Fourier transform (FT) of a temporal signal.

T = 2; //Total sampling time
N = 256;//Number of samples
dt = T/256; //sampling interval
t = [0:dt:(N-1)*dt];
f = 5; y = sin(2*%pi*f*t);//signal
f1 = scf(1); plot(t,y);
FY = fft(y);
F = 1/(2*dt); //max frequency FT can detect
df = 2*F/256; //discrete frequency
f = [-(df*(N/2)):df:df*(N/2 -1)];

f2 = scf(2); plot(f, fftshift(abs(FY)));

The results are:

Here are the questions:

1. How will you apply this for images?

In the above method, the FT of a certain signal was obtained. In doing so, we get the physical frequencies where the peaks occur. If we let the number of frequencies and magnitudes of the signal correspond to the number of pixels and grayscale values of the image respectively, the above method will give the pixel position where a certain grayscale value occur.

2. Questions
a. Light from a fluorescent lamp is known to flicker at 120Hz. What should be the threshold sampling interval for accurate FT analysis?

Consider the following:

df=1/N*dt
dt=T/N
df=126 Hz
dt=126*N=T/N
N^2=T/126
dt=126*sqrt(T/126)

In simulating this, I obtained the best threshold to be at T=100 and N= 13005 and dt=T/N

b) What is the effect of increasing the number of samples N in the FT?

Increasing N will increase the range of possible frequencies where the peaks will occur. In the code above, if we change N=255 to N=300, the resulting FT would be:

c) What is the effect of decreasing the sampling interval Δt in the FT?

1. If we look at line 4, it will decrease the length of the signal and hence the method will not be applied to the entire signal.

2. FT deals with frequency or 1/Δt. Increasing the frequency interval also increases the range of possible frequencies. Hence we decrease the chance of finding the exact position of the peak. The result is similar to the figure above.

d) What is the effect of fixing the total time interval T but increasing the
number of samples N?

Increasing N will increase the magnitude of the peak. When we apply this to scilab, the result will be:

No comments: