For example, I want to use fft to transform the simple function exp(-x.^2) defined in time domain. And the corresponding funciton in frequency domain is sqrt(pi).*exp(-k.^2/4).
And I use the upper fft expression defined in matlab.
But the result is
Obviously, the corresponding function in frequency domain could fit with the real(fftshift(fft(v)))
In fact, I want to directly use the corresponding function in frequency domain to calculate the convolution with another function instead of fft(v).
Is there any way to transform the corresponding function in frequency domain to the fft(v)?
code:
clear all; close all;
L=10; N=64;
x=L/N*[-N/2:N/2-1];
k=2*pi/L*[-N/2:N/2-1];
v=exp(-x.^2);
vt = fft(v);
vt_r = real(fftshift(vt))*L/N;
vt_i = imag(fftshift(vt))*L/N;
vt_ = abs(fftshift(vt))*L/N;
vf = sqrt(pi).*exp(-k.^2/4);
subplot(3,2,1)
plot(x,v,'k','LineWidth',1.5), xlabel x, ylabel v=exp(-x.^2)
subplot(3,2,2)
plot(k,vt_r,'k','LineWidth',1.5)
axis([-max(k) max(k) -2 round(max(vf))]), set(gca,'xtick',[]), ylabel real(fftshift(fft(v)))
subplot(3,2,3)
plot(k,vt_i,'k','LineWidth',1.5)
axis([-max(k) max(k) -2 round(max(vf))]), set(gca,'xtick',[]), ylabel imag(fftshift(fft(v)))
subplot(3,2,4)
plot(k,vt_ ,'k','LineWidth',1.5)
axis([-max(k) max(k) 0 round(max(vf))]), xlabel k, ylabel abs(fftshift(fft(v)))
subplot(3,2,5)
plot(k,vf,'k','LineWidth',1.5)
axis([-max(k) max(k) 0 round(max(vf))]),xlabel k, ylabel vf