# MATLAB Coding angular spectrum of waves in a fluid

Tags:
1. Mar 22, 2018

### chiraganand

Hi,
I am trying to code ultrasonic transducer radiation in water using angular spectrum of plane waves. I am having difficulties in the sampling and fft. If anybody has an idea about this can you please help me out? I can paste the code once i get some response.

2. Mar 22, 2018

### mfig

The thing is, it is hard to know whether I can help before I know more details. Perhaps post the code and explain in detail what you have and where you need to go with it.

3. Mar 22, 2018

### chiraganand

I dont know if the code makes any sense. Initially i assume the velocity on the trnasdcuer surface as constant and 1. I find the directivity function yy and then multiply this with the pressure in the fluid. This multiplied pressure I fast fourier transform to get the required pressure at the point. Let me know if I am right. Thank you for your help anyways!
tic;
clear all;
c=1480000; %speed of sound in water mm/sec.
f=5000000; %freq. in Hz
w=20; %transducer width in mm
xx=[];
fss=0.01
xx=[-40:fss:40];
zz=[];
zz=[1:0.1:400];
yy=sinc(w*(f/c)*(((xx))));
bbb=[];
dd = 1;
gg=length(xx);
x(1:gg)=0;
x(gg/2-w/(2*fss):gg/2+w/(2*fss))=1;
y=x;
%y=fft(x);
figure; plot(abs(y));
zzz=length(zz);
for ii =1:zzz
d=dd*zz(ii); %distance from transducer in mm
df(ii)=d;
p=y.*exp(1i*2.*(f/c).*pi.*d.^2.*sqrt(((((((xx.^2+d.^2))))))));
h=p.*yy;
u=fft(h);
g=u;
g=fftshift(u);
aaa(ii)=abs(g(round(gg/2)));
bbb(ii,:)=abs(w);
bbb(ii,:)=bbb(ii,:)/max(bbb(ii,;
end
figure; plot(df,aaa);
toc;

4. Mar 25, 2018

### chiraganand

I also chanced upon the FOCUS simulation software and they have an angular spectrum module. There are a few places in that code which I am not able to understand. If you could help me understand these parts of the code I would be extremely grateful