Use MATLAB\'s FFT and FFTSHIFT functions to find the (exponential) Fourier serie
ID: 2248184 • Letter: U
Question
Use MATLAB's FFT and FFTSHIFT functions to find the (exponential) Fourier series for the signal given below. Use two periods of the signal with a total of 128 sample points. Symmetric Sawtooth g(t) Period To 1 second 1.5 0.5 Time -1 -0.5 0.5 n=0 0.5 -1 Plot the magnitude (in volts) of Fourier series coefficients as follows: Arrange the plot so that the d.c. component (n-0) is at the center (use MATLAB function FFTSHIFT) and plot the n =-5 to n = +5 terms only vs. frequency (in Hertz). Calculate the magnitude (in volts) of the theoretically calculated (referred to in following as "actual") coefficients given by the formula. Do this for the terms n--5 to n = +5. Plot these magnitudes vs. frequency (in Hertz) a) b)Explanation / Answer
Using MATLAB .
You can use the following code:
==============================================================================
wx = (2.* pi .* x) ./ m;
wy = (2.* pi .* y) ./ n;
wx = ifftshift(wx); wy=ifftshift(wy);
Cp = fftshift(fft2(fftshift(p)));
Cq = fftshift(fft2(fftshift(q)));
C = -1i.*(wx .* Cp + wy .* Cq)./(wx.^2 + wy.^2);
Z = abs((ifft2(ifftshift(C))));
p = ifftshift(ifft2(ifftshift(1i * wx .* C)));
q = ifftshift(ifft2(ifftshift(1i * wy .* C)));
in=peaks(200); %// Define input signal
H=fftshift(fft2(in)); %// Compute 2D Fourier Transform
x0=-35; %// Define shifts
y0=-50;
%// Define shift in frequency domain
[xF,yF] = meshgrid(-100:99,-100:99);
%// Perform the shift
H=H.*exp(-1i*2*pi.*(xF*x0+yF*y0)/200);
the Fourier Transform
IF_image=ifft2(ifftshift(H));
figure;
subplot(1,2,1);
imshow(in);
subplot(1,2,2);
imshow(real(IF_image));
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.