Saturday, March 2, 2013

Simple Fourier Transform with Matlab - With Plots


% SimpFourierTransform1
clear Q, f;
f=3;
h = @(x,y) sin(2*pi*x*f).*exp(-2*pi*i*x.*y);
mintime=-1;
maxtime=1;
tim1=linspace(mintime,maxtime,1000);


  figure()
  subplot(2,1,1), plot(tim1, real(h(tim1,f)));
  title('Real Part of Integrated Function')
  xlabel('Time (seconds)');
  ylabel('Magnitude or real part');
  subplot(2,1,2), plot(tim1, imag(h(tim1,f)));
  title('Imaginery Part of Integrated Function')
  xlabel('Time (seconds)');
  ylabel('Magnitude of imaginery part');


for f=1:20;
  Q(f) = quad(@(x)h(x,f),mintime,maxtime);
end
figure()
  subplot(2,1,1), stem(round(real(Q)));
  title('Real Part of the result of the integral')
  xlabel('F (1/seconds)');
  ylabel('Magnitude or real part');
  subplot(2,1,2), stem(round(imag(Q)));
  title('Imaginery Part of the result of the integral')
  xlabel('F (1/seconds)');
  ylabel('Magnitude of imaginery part');



%stem(abs(Q))

Share:

0 comments:

Post a Comment