Hi Brad,
I'm attempting to simulate a phased array transducer with the specific details:
Number of elements = 64
Element Width = 0.53mm
Element Pitch = 0.63mm
Centre frequency = 5MHz
Bandwidth(-6dB) = 50%
The sampling frequency is supposed to be 100MHz.
I noticed a few issues:
1)The waves are propagating from both the bottom and top at the start and just bounces back at the 0 mark.
2)I can't change the element width.
3)When I changed the tone burst frequency to 5MHz, the waves started out with an irregular shape.
What are the problems causing this?
What I'd like to know is:
4)Is my current method of simulating Aluminum(with velocity of sound 6300ms^-1, and density of 2700kg/m^3) correct?
5)How do I input my sampling frequency of 100MHz?
6)How do I define the element pitch? (I read the manual, but couldn't find the method to do so)
7)The element width remains at 750micrometers no matter what value I change to. When it goes above 1, it shows an error. How do I rectify this?
8)By making all 64 elements active, am I achieving "full matrix capture"? Whereby when 1 element TX, the others are RX.
As I'm really new in MATLAB, it'll be best if things can be explained out according to my point form. I've been thrown to do a Final Year Project that invovles MATLAB(Which I am extremely bad at)
Thanks Brad!
Here is my code as shown below:
clc
clear all
close all
DATA_CAST='single';
% set the size of the perfectly matched layer (PML)
PML_X_SIZE = 2; % [grid points]
PML_Y_SIZE = 1; % [grid points]
PML_Z_SIZE = 1; % [grid points]
% set total number of grid points not including the PML
Nx = 196 - 2*PML_X_SIZE; % [grid points]
Ny = 126 - 2*PML_Y_SIZE; % [grid points]
Nz = 62 - 2*PML_Z_SIZE; % [grid points]
% set desired grid size in the x-direction not including the PML
x = 0.75/1000; % [m]
% calculate the spacing between the grid points
dx = x; % [m]
dy = dx; % [m]
dz = dx; % [m]
% create the k-space grid
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);
% define the properties of the propagation medium
medium.sound_speed = 6300*ones(Nx,Ny,Nz) ; % [m/s] 2nd
medium.sound_speed(1:Nx/2,:,:) = 1000 ; % [m/s] 1st 101
medium.density = 2700*ones(Nx,Ny,Nz); % [kg/m^3] 2nd
medium.density(1:round(Nx/2),:,:) = 1134 ; % [kg/m^3] 1st
medium.alpha_coeff = 0.001*ones(Nx,Ny,Nz); % [dB/(MHz^y cm)] 2nd
medium.alpha_coeff(1:round(Nx/2),:,:)=0.01 ; % [dB/(MHz^y cm)] 1st
medium.alpha_power = 1.5;
medium.BonA = 6;
% create the time array
t_end = 120e-6; % [s]
kgrid.t_array = makeTime(kgrid, medium.sound_speed, [], t_end);
% define properties of the input signal
source_strength = 10e6; % [Pa]
tone_burst_freq = 2.25e6; % [Hz]
tone_burst_cycles = 5;
% create the input signal using toneBurst
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);
% scale the source magnitude by the source_strength divided by the
% impedance (the source is assigned to the particle velocity)
input_signal = (source_strength./(1000*1134)).*input_signal;
% physical properties of the transducer
transducer.number_elements = 64; % total number of transducer elements
transducer.element_width = 1; % width of each element [grid points/voxels]
transducer.element_length = 12*4/3; % length of each element [grid points/voxels]
transducer.element_spacing = 0; % spacing (kerf width) between the elements [grid points/voxels]
transducer.radius = inf; % radius of curvature of the transducer [m]
% calculate the width of the transducer in grid points
transducer_width = transducer.number_elements*transducer.element_width ...
+ (transducer.number_elements - 1)*transducer.element_spacing;
% use this to position the transducer in the middle of the computational grid
transducer.position = round([1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);
% properties used to derive the beamforming delays
transducer.sound_speed = 1000; % sound speed [m/s]
transducer.focus_distance = 70/1000; % focus distance [m]
transducer.elevation_focus_distance = 68/1000; % focus distance in the elevation plane [m]
transducer.steering_angle = 0; % steering angle [degrees]
% apodization
transducer.transmit_apodization = 'Hanning';
transducer.receive_apodization = 'Rectangular';
% define the transducer elements that are currently active
number_active_elements = 64;
transducer.active_elements = ones(transducer.number_elements, 1);
%transducer.active_elements = zeros(transducer.number_elements, 1);
%transducer.active_elements(21:52) = 1;
% append input signal used to drive the transducer
transducer.input_signal = input_signal;
% create the transducer using the defined settings
transducer = makeTransducer(kgrid, transducer);
% print out transducer properties
transducer.properties;
% set the input settings
input_args = {'DisplayMask', transducer.active_elements_mask, ...
'PMLInside', true, 'PlotPML', true, 'PMLSize', [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...
'DataCast', DATA_CAST, 'PlotScale', [-source_strength/32, source_strength/32]};
% run the simulation
%[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer, input_args{:});
[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, transducer, input_args{:});
% extract a single scan line from the sensor data using the current
% beamforming settings
scan_line = transducer.scan_line(sensor_data);
% plot the recorded time series
figure;
stackedPlot(kgrid.t_array*1e6, sensor_data);
xlabel('Time [\mus]');
ylabel('Transducer Element');
title('Recorded Pressure');
% plot the scan line
figure;
plot(kgrid.t_array*1e6, scan_line, 'k-');
xlabel('Time [\mus]');
ylabel('Pressure [au]');
title('Scan Line After Beamforming');