0
f0=2.5e6; % 换能器中心频率 [Hz]
fs=100e6; % 仿真使用的采样频率
c=1540; % 声速 [m/s]
lambda=c/f0; % 波长 [m]
width=(0.32-0.05)/1000; % 阵元宽度
element_height=20/1000; % 阵元高度 [m]
kerf=0.05/1000; % 阵元间隙宽度 [m]
Ne=64; % 阵元数量
focus=[0 0 52]/1000; % 固定焦点位置 [m]
focal_depth=focus(3); % 焦点深度
array_size=(kerf+width)*Ne; % 阵元总宽度
dz=1/(2*f0)*c/2; % 距离方向分辨单元
set_sampling(fs);
xmit_aperture=xdc_linear_array(Ne,width,element_height,kerf,1,1,focus);
receive_aperture=xdc_linear_array(Ne,width,element_height,kerf,1,10,[0
10000000000000000000000000000000000000]);
channel_pos_tmp=xdc_get(xmit_aperture,'rect');
channel_pos=channel_pos_tmp(8,:);
impulse_response=cos(2*pi*f0*(0:1/fs:2/f0));
impulse_response=impulse_response.*hanning(max(size(impulse_response)))';
xdc_impulse(xmit_aperture, impulse_response);
xdc_impulse(receive_aperture, impulse_response);
excitation=cos(2*pi*f0*(0:1/fs:1/f0));
xdc_excitation(xmit_aperture, excitation);
apo_vector=ones(1,Ne);
xdc_apodization(xmit_aperture,0,apo_vector);
SL=91; % 相控阵扫描线数为 91 线
ln_num=46; % 以垂直方向即中间扫描线为例
d_th=2*sin(45/180*pi)/(SL-1); % 相控阵扫描线夹角正弦值相等
sin_th=sin(-45/180*pi)+(ln_num-1)*d_th;
th=asin(sin_th);
focus_pt=[focal_depth*sin(th) 0 focal_depth*cos(th)];
delay_tx=-1*(sqrt((channel_pos-focus_pt(1)).^2+focus_pt(3)^2)-focal_depth)/c;
toff_c=delay_tx;
xdc_focus_times(xmit_aperture,0,(toff_c));
fp=zeros(100,100);
for x=1:100
for z=1:100
[hp,start_time]=calc_hp(xmit_aperture,[(x-51)*0.2/1000, 0,(z+10)*1/1000;]);
fp(z,x)=max(hp(:,1));
end
end
env=fp/max(max(fp));
env=log(env+0.1);
env=env-min(min(env));
env=64*env/max(max(env));
figure;
image(env);
return
Nt=3; % 目标个数为 3
phantom_positions=[0/1000 0 15/1000; 0/1000 0 28/1000; 0/1000 0 40/1000];
phantom_amplitudes=ones(Nt,1)*20;
xdc_center_focus(xmit_aperture,[0 0 0]);
xdc_center_focus(receive_aperture,[0 0 0]);
for i=1:SL
sin_th(i)=sin(-45/180*pi)+(i-1)*d_th;
th=asin(sin_th(i));
focus_pt=[focal_depth*sin(th) 0 focal_depth*cos(th)];
delay_tx(i,:)=-1*(sqrt((channel_pos-focus_pt(1)).^2+focus_pt(3)^2)-focal_depth)/
c;
toff_c=delay_tx(i,:);
xdc_focus_times(xmit_aperture,0,(toff_c));
xdc_apodization(xmit_aperture,0,apo_vector);
[v,t1]=calc_scat(xmit_aperture,receive_aperture,phantom_positions,phantom_amplit
udes);
image_data(1:max(size(v)),i)=v;
times(i)=t1;
end
min_sample=min(times)*fs;
max_sample=max(times)*fs;
[n,m]=size(image_data);
n=n+(max_sample-min_sample);
for i=1:SL
rf_env=abs(hilbert([zeros(times(i)*fs-min_sample,1);
image_data(:,i)]));
env(i,1:max(size(rf_env)))=rf_env';
end
env=env/max(max(env));
env=log(env+0.1);
env=env-min(min(env));
env=64*env/max(max(env));
image(env);
colormap(gray(64));
xdc_free (xmit_aperture);
xdc_free (receive_aperture);