<?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: Defining An Ultrasound Transducer Example Question</title>
		<link>http://www.k-wave.org/forum/topic/defining-an-ultrasound-transducer-example-question</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 22:02:37 +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/defining-an-ultrasound-transducer-example-question" rel="self" type="application/rss+xml" />

		<item>
			<title>cyl on "Defining An Ultrasound Transducer Example Question"</title>
			<link>http://www.k-wave.org/forum/topic/defining-an-ultrasound-transducer-example-question#post-9099</link>
			<pubDate>Tue, 04 Jun 2024 13:31:14 +0000</pubDate>
			<dc:creator>cyl</dc:creator>
			<guid isPermaLink="false">9099@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello, I would like to know how your problem was resolved
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Defining An Ultrasound Transducer Example Question"</title>
			<link>http://www.k-wave.org/forum/topic/defining-an-ultrasound-transducer-example-question#post-8968</link>
			<pubDate>Wed, 29 Nov 2023 19:50:28 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8968@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;You can get the full source code for all the examples, just open the k-Wave help in the MATLAB help browser.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Muhammad on "Defining An Ultrasound Transducer Example Question"</title>
			<link>http://www.k-wave.org/forum/topic/defining-an-ultrasound-transducer-example-question#post-8966</link>
			<pubDate>Tue, 28 Nov 2023 17:25:15 +0000</pubDate>
			<dc:creator>Muhammad</dc:creator>
			<guid isPermaLink="false">8966@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, I was trying to work through this example on the k-Wave website: &#60;a href=&#34;http://www.k-wave.org/documentation/example_us_defining_transducer.php&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org/documentation/example_us_defining_transducer.php&#60;/a&#62; but am having issues replicating their results. The code I used is:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;% create the computational grid
Nx = 128;           % number of grid points in the x (row) direction
Ny = 128;           % number of grid points in the y (column) direction
Nz = 128;
dx = 0.1e-3;        % grid point spacing in the x direction [m]
dy = 0.1e-3;        % grid point spacing in the y direction [m]
dz = 0.1e-3;        % grid point spacing in the z direction [m]
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz,dz);

% define the properties of the propagation medium
medium.sound_speed = 1500 * ones(Nx, Ny);   % [m/s]
medium.sound_speed(1:Nx/2, :) = 1800;       % [m/s]
medium.density = 1000 * ones(Nx, Ny);       % [kg/m^3]
medium.density(:, Ny/4:Ny) = 1200;          % [kg/m^3]

kgrid.makeTime(medium.sound_speed)

% define properties of the input signal
source_strength = 1e6;          % [MPa]
tone_burst_freq = 0.5e6;        % [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 ./ (medium.sound_speed * medium.density)).* input_signal;

% physical properties of the transducer
transducer.number_elements = 72;    % total number of transducer elements
transducer.element_width = 1;       % width of each element [grid points]
transducer.element_length = 12;     % length of each element [grid points]
transducer.element_spacing = 0;     % spacing (kerf width) between the elements [grid points]
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 = 1540;                  % sound speed [m/s]
transducer.focus_distance = 20e-3;              % focus distance [m]
transducer.elevation_focus_distance = 19e-3;    % focus distance in the elevation plane [m]
transducer.steering_angle = 0;                  % steering angle [degrees]

% apodization
transducer.transmit_apodization = &#38;#39;Rectangular&#38;#39;;
transducer.receive_apodization = &#38;#39;Rectangular&#38;#39;;

% define the transducer elements that are currently active
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 = kWaveTransducer(kgrid, transducer);

% create a sensor mask covering the entire computational domain using the
% opposing corners of a rectangle
sensor.mask = [1, 1, Nx, Ny].&#38;#39;;

% set the record mode to capture the final wave-field and the statistics at
% each sensor point
sensor.record = {&#38;#39;p_final&#38;#39;, &#38;#39;p_max&#38;#39;, &#38;#39;p_rms&#38;#39;};

% run the simulation
[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, sensor, input_args{:});&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;But I get the following error:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;Arrays have incompatible sizes for this operation.

Error in DefiningAnUltrasoundTransducerExample (line 28)
input_signal =  (source_strength ./ (medium.sound_speed * medium.density)).* input_signal;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;In the example, the computational grid and medium properties are not shown so I used the values shown in other examples in the same section so I assume my issue is related to something the top sections. Thanks in advance for any help.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
