<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: Simulating pulse-echo of single element in a heterogeneous medium</title>
		<link>http://www.k-wave.org/forum/topic/simulating-pulse-echo-of-single-element-in-a-heterogeneous-medium</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 17:22:20 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/simulating-pulse-echo-of-single-element-in-a-heterogeneous-medium" rel="self" type="application/rss+xml" />

		<item>
			<title>csheaff on "Simulating pulse-echo of single element in a heterogeneous medium"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-pulse-echo-of-single-element-in-a-heterogeneous-medium#post-6247</link>
			<pubDate>Thu, 21 Dec 2017 00:30:55 +0000</pubDate>
			<dc:creator>csheaff</dc:creator>
			<guid isPermaLink="false">6247@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;Thanks very much for the feedback. I set the 'PLMInside' option to false, and now I'm getting good results. &#60;/p&#62;
&#60;p&#62;Clay
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Simulating pulse-echo of single element in a heterogeneous medium"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-pulse-echo-of-single-element-in-a-heterogeneous-medium#post-6246</link>
			<pubDate>Mon, 18 Dec 2017 10:29:21 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6246@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi csheaff,&#60;/p&#62;
&#60;p&#62;Your source and sensor are inside the PML, which you've set to 30 grid points in your simulation. Axially, you could solve this by moving the source by 30 grid points. However, laterally, your simulation dimension is 64 by 64, and the PML covers 60 grid points (30 on each side). So you will need to make your simulation bigger (e.g., by setting 'PMLInside', false) or reducing the size of the PML (10 is the default, although a larger PML will be more effective).&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>csheaff on "Simulating pulse-echo of single element in a heterogeneous medium"</title>
			<link>http://www.k-wave.org/forum/topic/simulating-pulse-echo-of-single-element-in-a-heterogeneous-medium#post-6243</link>
			<pubDate>Wed, 13 Dec 2017 14:55:35 +0000</pubDate>
			<dc:creator>csheaff</dc:creator>
			<guid isPermaLink="false">6243@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I am trying to generate simulated pulse-echos created/detected by a single element concave transducer in a heterogeneous medium for purposes of attempting different methods of estimating attenuation coefficient. As the simulation seems a bit generic, could someone point me towards an example program if it already exists?&#60;/p&#62;
&#60;p&#62;I've created a script to run this simulation, but the signals are rather damped despite making many adjustments. So I was curious if someone could perhaps indicate something I'm not doing quite right. Any tips would be most appreciated!&#60;/p&#62;
&#60;p&#62;% Focussed Detector In 3D Example&#60;br /&#62;
%&#60;br /&#62;
% This example shows how k-Wave can be used to model the output of a&#60;br /&#62;
% focussed bowl detector in 3D where the directionality arises from&#60;br /&#62;
% spatially averaging across the detector surface. It builds on the&#60;br /&#62;
% Focussed Detector In 2D Example.&#60;br /&#62;
%&#60;/p&#62;
&#60;p&#62;clearvars;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% create the computational grid&#60;br /&#62;
% dx, dy, dz dictate the size of the grid, as their units is meters. i.e.&#60;br /&#62;
% the size of the grid is [1:Nx]*dx in the depth dimension&#60;br /&#62;
Nx = 256; %10*64;            % number of grid points in the x direction&#60;br /&#62;
Ny = 64; %64;            % number of grid points in the y direction&#60;br /&#62;
Nz = 64;            % number of grid points in the z direction&#60;br /&#62;
res = 1e-4;&#60;br /&#62;
dx = res; %10e-3/Nx;     % grid point spacing in the x direction [m]&#60;br /&#62;
dy = res;            % grid point spacing in the y direction [m]&#60;br /&#62;
dz = res;            % grid point spacing in the z direction [m]&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
% define the properties of the propagation medium&#60;br /&#62;
c0 = 1540;                      % [m/s]&#60;br /&#62;
rho0 = 1000;                    % [kg/m^3]&#60;br /&#62;
medium.alpha_coeff = 0.5;      % [dB/(MHz-cm)]&#60;br /&#62;
medium.alpha_power = 1.01;&#60;br /&#62;
medium.BonA = 6;  % parameter of nonlinearity&#60;/p&#62;
&#60;p&#62;medium.sound_speed = c0;	% [m/s]&#60;/p&#62;
&#60;p&#62;% define a random distribution of scatterers for the medium&#60;br /&#62;
background_map_mean = 1;&#60;br /&#62;
background_map_std = 0.008;&#60;br /&#62;
background_map = background_map_mean + background_map_std * randn([Nx, Ny, Nz]);&#60;/p&#62;
&#60;p&#62;% define properties&#60;br /&#62;
sound_speed_map = c0 * ones(Nx, Ny, Nz) .* background_map;&#60;br /&#62;
density_map = rho0 * ones(Nx, Ny, Nz) .* background_map;&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
% define the properties of the propagation medium&#60;br /&#62;
% medium.sound_speed = 1500;	% [m/s]&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
kgrid.makeTime(medium.sound_speed);&#60;/p&#62;
&#60;p&#62;% create a concave sensor&#60;br /&#62;
sphere_offset = 0;                             % [grid points]&#60;br /&#62;
diameter = Ny/4 + 1;                            % [grid points]&#60;br /&#62;
radius = 100*Nx; %Nx/2;                                  % radius of curvature [grid points]&#60;br /&#62;
bowl_pos = [1 + sphere_offset, Ny/2, Nz/2];     % [grid points]&#60;br /&#62;
% x is depth dimension&#60;br /&#62;
focus_pos = [100*Nx, Ny/2, Nz/2]; %[Nx/2, Ny/2, Nz/2];                 % [grid points]&#60;br /&#62;
sensor.mask = makeBowl([Nx, Ny, Nz], bowl_pos, radius, diameter, focus_pos);&#60;/p&#62;
&#60;p&#62;% % define a time varying sinusoidal source&#60;br /&#62;
% source_freq = 0.25e6;                           % [Hz]&#60;br /&#62;
% source_mag = 1;                                 % [Pa]&#60;br /&#62;
% source.p = source_mag * sin(2 * pi * source_freq * kgrid.t_array);&#60;br /&#62;
% source.p = filterTimeSeries(kgrid, medium, source.p);&#60;br /&#62;
% &#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
% define properties of the input signal&#60;br /&#62;
source_strength = 100e6;          % [Pa]&#60;br /&#62;
tone_burst_freq = 5e6;%0.25e6; %1.5e6;        % [Hz]&#60;br /&#62;
tone_burst_cycles = 4;&#60;/p&#62;
&#60;p&#62;% create the input signal using toneBurst&#60;br /&#62;
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);&#60;/p&#62;
&#60;p&#62;% scale the source magnitude by the source_strength divided by the&#60;br /&#62;
% impedance (the source is assigned to the particle velocity)&#60;br /&#62;
input_signal = (source_strength ./ (c0 * rho0)) .* input_signal;&#60;/p&#62;
&#60;p&#62;% filter the source to remove any high frequencies not supported by the grid&#60;br /&#62;
source.p = filterTimeSeries(kgrid, medium, input_signal);&#60;/p&#62;
&#60;p&#62;% give sensor finite bandwidth&#60;br /&#62;
bandwidth_pct = 50;&#60;br /&#62;
sensor.frequency_response = [tone_burst_freq, bandwidth_pct];&#60;/p&#62;
&#60;p&#62;source.p_mask = sensor.mask; %source1;&#60;br /&#62;
input_args = {'PMLSize', 30, 'DataCast', 'off', 'PlotSim', false, ...&#60;br /&#62;
    'DataRecast', true};&#60;/p&#62;
&#60;p&#62;nIterations = 2;&#60;br /&#62;
for nnn = 1:nIterations&#60;br /&#62;
    % shuffle scatterers to simulate another instance of media with the&#60;br /&#62;
    % same properties.&#60;br /&#62;
    id1 = randperm(size(sound_speed_map,1));&#60;br /&#62;
    id2 = randperm(size(sound_speed_map,2));&#60;br /&#62;
    id3 = randperm(size(sound_speed_map,3));&#60;br /&#62;
    sound_speed_map_shuffled = sound_speed_map(id1, id2, id3);&#60;/p&#62;
&#60;p&#62;    id1 = randperm(size(density_map,1));&#60;br /&#62;
    id2 = randperm(size(density_map,2));&#60;br /&#62;
    id3 = randperm(size(density_map,3));&#60;br /&#62;
    density_map_shuffled = density_map(id1, id2, id3);&#60;/p&#62;
&#60;p&#62;    medium.sound_speed = sound_speed_map_shuffled;&#60;br /&#62;
    medium.density = density_map_shuffled;  &#60;/p&#62;
&#60;p&#62;    %% run the first simulation&#60;/p&#62;
&#60;p&#62;    sensor_data1 = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;    % average the data recorded at each grid point to simulate the measured&#60;br /&#62;
    % signal from a single element focussed detector&#60;br /&#62;
    sensor_data1_sum(:, nnn) = sum(sensor_data1, 1);       &#60;/p&#62;
&#60;p&#62;end&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% plot the detector and on-axis and off-axis point sources&#60;br /&#62;
% voxelPlot(sensor.mask + source1);&#60;br /&#62;
voxelPlot(sensor.mask)&#60;br /&#62;
view([130, 40]);&#60;/p&#62;
&#60;p&#62;% get a suitable scaling factor for the time axis&#60;br /&#62;
[~, t_scale, t_prefix] = scaleSI(kgrid.t_array(end));&#60;/p&#62;
&#60;p&#62;% plot the time series corresponding to the on-axis and off-axis sources&#60;br /&#62;
figure&#60;br /&#62;
plot(kgrid.t_array * t_scale, sensor_data1_sum, '-');&#60;br /&#62;
% hold on&#60;br /&#62;
% plot(kgrid.t_array * t_scale, sensor_data2, 'r-');&#60;br /&#62;
xlabel(['Time [' t_prefix 's]']);&#60;br /&#62;
ylabel('Average Pressure Measured By Focussed Detector [Pa]');&#60;br /&#62;
% legend('Source on axis', 'Source off axis');&#60;/p&#62;
&#60;p&#62;%save
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
