fourier transform space dependent function

3 Ansichten (letzte 30 Tage)
friet
friet am 23 Feb. 2017
Beantwortet: Bjorn Gustavsson am 23 Feb. 2017
Hello folks,
I am calculating the inverse Fourier transform of the equations below. alpha and beta are two frequency dependent constants. z is the space dimension. I write the Matlab code, however, the answer I got for P(t,z) doesn't make sense. can you please check my program to do inverse Fourier transform.
Thanks
clc
clear all
close all
f=linspace(0,20*10^6,30); %[Hz]
z=linspace(0,2*10^-6,30); %[m]
v=2000;
alpha= 5; %[Neper/cm]
% alpha=((3.2*10^-14).*f.^2) + 5;
beta=(2*pi*f/v); %[Hz]
figure(1)
plot(f*10^-6,beta*0.01)
xlabel('f[MHz]')
ylabel('alpha[N/cm]')
pf0=1;
pfz=zeros(length(z),length(f));
pft=zeros(length(z),length(f));
for j=1:length(f)
for i=length(z)
pfz(i,j)=pf0.*exp(-alpha.*z(i)).*exp(-sqrt(-1).*beta(j).*z(i));
end
end
for j=1:length(f)
for i=length(z)
pft(i,j)=ifft(pfz(i,j));
end
end
figure(2)
plot(z,abs(pft))

Antworten (1)

Bjorn Gustavsson
Bjorn Gustavsson am 23 Feb. 2017
You shouldn't do the inverse Fourier transform element by element. The inverse Fourier transform should be calculated in the frequency direction for each z-coordinate. You can do that in one loop over i (I'd suggest you stop using i and j as indices and start using better named loop-variables such as i_z and i_f, then you can use i and j as sqrt(-1) and you'll have better grasp of what each loop-index is) or you could use the ifft command in one go on the whole matrix. You should look at the documentation to see what the calling syntax is when you want the 1-D Fourier transform in one direction. Also you should remember to use fftshift after the ifft.
HTH

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by