% This m-file creates a simulated group of time-series' due to two perfect
% point reflectors located at a user-defined location in the field of
% interest.
clear all; close all;
% Material properties
c=1500; % Sound speed in medium of interest, (m/s)
% Pulse properties
fc=5e6; % Center frequency of pulse, (Hz)
lam=c/fc; % Wavelength at center frequency, (m)
bw=0.5; % Fractional bandwidth, ()
% Define receive array
p=lam/2; % Pitch between elements
N=128; % Number of receivers
L_array=(N-1)*p; % Length of array, (m)
X=zeros(1,N);
X_sum=0;
for m=1:N
X(m)=(m-1)*p;
end
% Define maximum imaging depth
r_max=5e-2; % Maximum depth inspected, (m)
t_max=2*sqrt(r_max^2+(L_array/2)^2)/c; % Maximum time to listen, (s)
% Create time vector
dt=1/(25*fc); % Time increment for data aquisition; (s)
t=0:dt:t_max;
% Locate reflector
Xr1=L_array/1.5; % Reflector 1 coordinates as functions of the array
Yr1=r_max/6; % & max depth dimensions
Xr2=L_array/2.3; % Reflector 2 coordinates as functions of the array
Yr2=r_max/3; % & max depth dimensions
Xt=L_array/2; Yt=0; % Source location (middle of array)
r1=sqrt((Xr1-Xt)^2+(Yr1-Yt)^2);
r2=sqrt((Xr2-Xt)^2+(Yr2-Yt)^2);
td1=zeros(1,N); td2=td1; p_rfl=zeros(length(t),N); t_ind1=td1; t_ind2=td2;
for i=1:N
td1(i)=(r1+sqrt((X(i)-Xr1)^2+Yr1^2))/c;
t_ind1(i)=round(td1(i)/dt);
td2(i)=(r2+sqrt((X(i)-Xr2)^2+Yr2^2))/c;
t_ind2(i)=round(td2(i)/dt);
p_rfl(:,i)=(0.1/r1)*gauspuls(t-td1(i),fc,bw)+...
(0.1/r2)*gauspuls(t-td2(i),fc,bw); % Includes spherical spreading
end
p_rfl_ht=hilbert(p_rfl);
save 'Time_Series'
% This figure can show the time-series of various
% figure; plot(t*1e6,p_rfl(:,1),'k',t*1e6,p_rfl(:,16),'b--',...
% t*1e6,p_rfl(:,25),'r-.');grid
% xlabel('Time, (\mus)'); ylabel('Signal')
% ------------------------------------------------------------
% Plot envelope as a function of time for all receive elements (like a
% waterfall plot)
figure; imagesc(t*1e6,X*1e3,abs(p_rfl_ht'))
xlabel('Time, (\mus)'); ylabel('Element Location, (mm)')
评论0