- plots a 1-D sinusoid with N=256, T=2, and f=5
- gets the Fourier Transform of said sinusoid signal
- computes the frequency scale
- plots the fftshifted output with the computed frequency axis
N = 256;
dt = T/256;
t = [0:dt:(N-1)*dt];
f = 5;
y = sin(2*%pi*f*t);
f1 = scf(1);
plot(t,y);
FY = fft(y);
F = 1/(2*dt);
df = 2*F/256;
f = [-(df*(N/2)):df:df*(N/2 -1)];
f2 = scf(2);
plot(f, fftshift(abs(FY)));
these are the outputted graphs:
**For images (indexed, grayscale), you simply apply the two-dimensional discrete fourier transform with f(a,b) in the place of x(n,m) where f(a,b) is the image in spatial dimensions. This outputs a complex number valued image that can be displayed with magnitude and phase parts. The FT-ed image is then shifted to make the image mean F(0,0) at the very center, so as to make the image points with higher frequencies correspondingly farther away from the center; this helps you distinguish and access the geometrical characteristics of the input image.
SOME QUESTIONS:
a) Light from a fluorescent lamp is known to flicker at 120Hz. What
should be the threshold sampling interval for accurate FT analysis?
-Using the equation Fmax=1/2(dt), where Fmax is the maximum frequency the FT can detect without aliasing and dt is the sampling interval; we input the frequency 120Hz into the rewritten dt=1/2f to get dt=0.0041667, the threshold sampling interval.
b) What is the effect of increasing the number of samples N in the FT?
-Increasing N would result in (other than the obvious increase in magnitude of the fftshifted output) decreasing the frequency spacing df, allowing us to detect the frequencies with better accuracy.
*original ft beside ft with increased N (from 256 to 1000)
c)What is the effect of decreasing the sampling interval Δt in the FT?
-decreasing the sampling interval dt increases the maximum frequency Fmax. it also affects the resolution of the resulting FT.
*original ft beside ft with decreased dt (from 0.0078125 to 0.0019531)
d) What is the effect of fixing the total time interval T but increasing the
number of samples N?
-
SOME QUESTIONS:
a) Light from a fluorescent lamp is known to flicker at 120Hz. What
should be the threshold sampling interval for accurate FT analysis?
-Using the equation Fmax=1/2(dt), where Fmax is the maximum frequency the FT can detect without aliasing and dt is the sampling interval; we input the frequency 120Hz into the rewritten dt=1/2f to get dt=0.0041667, the threshold sampling interval.
b) What is the effect of increasing the number of samples N in the FT?
-Increasing N would result in (other than the obvious increase in magnitude of the fftshifted output) decreasing the frequency spacing df, allowing us to detect the frequencies with better accuracy.
*original ft beside ft with increased N (from 256 to 1000)
c)What is the effect of decreasing the sampling interval Δt in the FT?
-decreasing the sampling interval dt increases the maximum frequency Fmax. it also affects the resolution of the resulting FT.
*original ft beside ft with decreased dt (from 0.0078125 to 0.0019531)
d) What is the effect of fixing the total time interval T but increasing the
number of samples N?
-
- i give myself a grade of 10 for this activity because i answered the questions adequately, and ran the programs with the desired/expected results within the class period, even with all the technical difficulties I faced with the PC which forced me to redo everything.(coding, typing, etc.)
No comments:
Post a Comment