fourier transform space dependent function

3 ビュー (過去 30 日間)
friet
friet 2017 年 2 月 23 日
回答済み: Bjorn Gustavsson 2017 年 2 月 23 日
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))

回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2017 年 2 月 23 日
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

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by