<?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: Input signal for ultrasound simulation</title>
		<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:39:51 +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/input-signal-for-ultrasound-simulation" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-337</link>
			<pubDate>Wed, 29 Feb 2012 05:20:21 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">337@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Daniele,&#60;/p&#62;
&#60;p&#62;Indeed, this issue should be fixed in the new release (B.0.5). If it's not, please let us know. Thanks for your feedback and for reporting this bug. It's very much appreciated!&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ghost82 on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-333</link>
			<pubDate>Tue, 28 Feb 2012 16:35:59 +0000</pubDate>
			<dc:creator>ghost82</dc:creator>
			<guid isPermaLink="false">333@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you Bradley, I think now it is fixed in the new release, I will try it.&#60;br /&#62;
However I followed your suggestion and I was able to simulate with source.ux.&#60;/p&#62;
&#60;p&#62;Thank you,&#60;/p&#62;
&#60;p&#62;Daniele
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-282</link>
			<pubDate>Mon, 30 Jan 2012 00:21:54 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">282@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Daniele,&#60;/p&#62;
&#60;p&#62;The problem is due to a bug in setting the data type for the delay mask used to apply the input signal to the grid points that form part of the ultrasound transducer. The data type is incorrectly based only on the delays, and not the delays + the length of the source.&#60;/p&#62;
&#60;p&#62;If you open &#60;code&#62;kspaceFirstOrder_inputChecking.m&#60;/code&#62; in the private folder, and replace lines 441-448 with:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% convert the data type depending on the maximum value of the delay
% mask and the length of the source
max_delay = max(delay_mask(:)) + length(transducer_input_signal) + 1;
if max_delay &#38;lt; intmax(&#38;#39;uint8&#38;#39;);
    delay_mask = uint8(delay_mask);
elseif max_delay &#38;lt; intmax(&#38;#39;uint16&#38;#39;);
    delay_mask = uint16(delay_mask);
elseif max_delay &#38;lt; intmax(&#38;#39;uint32&#38;#39;);
    delay_mask = uint32(delay_mask);
end&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;That should fix the problem. Thanks for posting about the strange behaviour!&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ghost82 on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-281</link>
			<pubDate>Sun, 22 Jan 2012 09:34:40 +0000</pubDate>
			<dc:creator>ghost82</dc:creator>
			<guid isPermaLink="false">281@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you Bradley for yuor reply, I will try what you suggest and I will get back.&#60;/p&#62;
&#60;p&#62;Daniele
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-280</link>
			<pubDate>Sun, 22 Jan 2012 09:14:17 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">280@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Daniele,&#60;/p&#62;
&#60;p&#62;Thanks for your feedback. To answer your previous questions:&#60;/p&#62;
&#60;p&#62;1.) Yes, the pressure is specified in units of Pascals, the [MPa] in the example comments is a typo.&#60;/p&#62;
&#60;p&#62;2.) When the optional input &#60;code&#62;&#38;#39;PMLInside&#38;#39;&#60;/code&#62; is set to &#60;code&#62;false&#60;/code&#62;, the grid specified by the user is expanded by the values set for &#60;code&#62;&#38;#39;PMLSize&#38;#39;&#60;/code&#62; This region is used as an absorbing boundary layer. To force the total size of the computational grid to be a power of 2 (the FFT is fastest when the grid size is a power of two or has small prime factors), the PML size is subtracted from the desired size. This step is not required for the simulation to work (you can use any grid size).&#60;/p&#62;
&#60;p&#62;3.) The pressure is always acoustic (or excess) pressure. This is the dynamic perturbation to the ambient pressure in the medium caused by the acoustic wave.&#60;/p&#62;
&#60;p&#62;Regarding your simulation, I am also puzzled why your source stops transmitting. I can't see anything immediately wrong with your code. Leave it with me, and I'll get back to you. In the meantime, you could directly assign &#60;code&#62;source.u_mask&#60;/code&#62; to represent your transducer, and then assign your signal to &#60;code&#62;source.ux&#60;/code&#62; (i.e., try the same thing not using the transducer class).&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ghost82 on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-279</link>
			<pubDate>Sat, 21 Jan 2012 21:40:47 +0000</pubDate>
			<dc:creator>ghost82</dc:creator>
			<guid isPermaLink="false">279@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Good morning all!&#60;/p&#62;
&#60;p&#62;ok, I think I understand a bit more...&#60;/p&#62;
&#60;p&#62;1)My input signal should be:&#60;br /&#62;
source_strength = 113000;&#60;br /&#62;
freq = 25000;&#60;br /&#62;
input_signal = source_strength*sin(2*pi*freq*kgrid.t_array);&#60;br /&#62;
input_signal = (1./(medium.sound_speed*medium.density)).*input_signal;&#60;/p&#62;
&#60;p&#62;where 113000 is my pressure amplitude calculated from (2*intensity*sounda velocity*rho water)^0.5 with the intensity equal to power/area of irradiation of the transducer.&#60;br /&#62;
P0, my ambient pressure, hasn't to be included in the transducer signal, as all is referenced to 0 Pascal gauge.&#60;/p&#62;
&#60;p&#62;2)I think I understand also the PML lines: they generate a border around my domain as perfectly matched layer.&#60;/p&#62;
&#60;p&#62;3)Units in the final charts should be Mpag.&#60;/p&#62;
&#60;p&#62;Am I right?&#60;/p&#62;
&#60;p&#62;Now I have another doubt:&#60;br /&#62;
I run a simulation with this code:&#60;/p&#62;
&#60;p&#62;clear all;&#60;/p&#62;
&#60;p&#62;% simulation settings&#60;br /&#62;
DATA_CAST = 'single';       % set to 'single' or 'gsingle' to speed up computations&#60;br /&#62;
MASK_PLANE = 'xy';          % set to 'xy' or 'xz' to generate the beam pattern in different planes&#60;br /&#62;
USE_STATISTICS = true;      % set to true to compute the rms or peak beam patterns, set to false to compute the harmonic beam patterns manually&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE K-WAVE GRID&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% set the size of the perfectly matched layer (PML)&#60;br /&#62;
PML_X_SIZE = 10;            % [grid points]&#60;br /&#62;
PML_Y_SIZE = 10;            % [grid points]&#60;br /&#62;
PML_Z_SIZE = 10;            % [grid points]&#60;/p&#62;
&#60;p&#62;% set total number of grid points not including the PML&#60;br /&#62;
Nx = 40 + 2*PML_X_SIZE;    % [grid points]&#60;br /&#62;
Ny = 40 + 2*PML_Y_SIZE;     % [grid points]&#60;br /&#62;
Nz = 40 + 2*PML_Z_SIZE;     % [grid points]&#60;/p&#62;
&#60;p&#62;% set desired grid size in the x-direction not including the PML&#60;br /&#62;
%x = 1e-3;                  % [m]&#60;/p&#62;
&#60;p&#62;% calculate the spacing between the grid points&#60;br /&#62;
dx = 1e-2;                  % [m]&#60;br /&#62;
dy = 1e-2;                    % [m]&#60;br /&#62;
dz = 1e-2;                    % [m]&#60;/p&#62;
&#60;p&#62;% create the k-space grid&#60;br /&#62;
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE MEDIUM PARAMETERS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 1450;      % [m/s]&#60;br /&#62;
medium.density = 998.2;          % [kg/m^3]&#60;br /&#62;
medium.alpha_coeff = 0.75;      % [dB/(MHz^y cm)]&#60;br /&#62;
medium.alpha_power = 1.5;&#60;br /&#62;
medium.BonA = 6;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
t_end = 1000e-6;                  % [s]&#60;br /&#62;
kgrid.t_array = makeTime(kgrid, medium.sound_speed, [], t_end);&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE INPUT SIGNAL&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% define properties of the input signal&#60;br /&#62;
source_strength = 113000;          % [Pa]&#60;br /&#62;
freq = 25000;    	% [Hz]&#60;/p&#62;
&#60;p&#62;% create the input signal using toneBurst&#60;br /&#62;
input_signal = source_strength*sin(2*pi*freq*kgrid.t_array);&#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 = (1./(medium.sound_speed*medium.density)).*input_signal;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE THE ULTRASOUND TRANSDUCER&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% physical properties of the transducer&#60;br /&#62;
transducer.number_elements = 1;    % total number of transducer elements&#60;br /&#62;
transducer.element_width = 4;       % width of each element [grid points]&#60;br /&#62;
transducer.element_length = 4;     % length of each element [grid points]&#60;br /&#62;
transducer.element_spacing = 0;     % spacing (kerf  width) between the elements [grid points]&#60;br /&#62;
transducer.radius = inf;            % radius of curvature of the transducer [m]&#60;/p&#62;
&#60;p&#62;% calculate the width of the transducer in grid points&#60;br /&#62;
transducer_width = transducer.number_elements*transducer.element_width ...&#60;br /&#62;
    + (transducer.number_elements - 1)*transducer.element_spacing;&#60;/p&#62;
&#60;p&#62;% use this to position the transducer in the middle of the computational grid&#60;br /&#62;
transducer.position = round([1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);&#60;/p&#62;
&#60;p&#62;% properties used to derive the beamforming delays&#60;br /&#62;
transducer.sound_speed = 6000;              % sound speed [m/s]&#60;br /&#62;
transducer.focus_distance = 1e-3;          % focus distance [m]&#60;br /&#62;
transducer.elevation_focus_distance = 1e-3;% focus distance in the elevation plane [m]&#60;br /&#62;
transducer.steering_angle = 0;              % steering angle [degrees]&#60;/p&#62;
&#60;p&#62;% apodization&#60;br /&#62;
transducer.transmit_apodization = 'Rectangular';&#60;br /&#62;
transducer.receive_apodization = 'Rectangular';&#60;/p&#62;
&#60;p&#62;% define the transducer elements that are currently active&#60;br /&#62;
transducer.active_elements = ones(transducer.number_elements, 1);&#60;/p&#62;
&#60;p&#62;% append input signal used to drive the transducer&#60;br /&#62;
transducer.input_signal = input_signal;&#60;/p&#62;
&#60;p&#62;% create the transducer using the defined settings&#60;br /&#62;
transducer = makeTransducer(kgrid, transducer);&#60;/p&#62;
&#60;p&#62;% print out transducer properties&#60;br /&#62;
transducer.properties;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% DEFINE SENSOR MASK&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% define a sensor mask through the central plane&#60;br /&#62;
sensor.mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
switch MASK_PLANE&#60;br /&#62;
    case 'xy'&#60;br /&#62;
        % define mask&#60;br /&#62;
        sensor.mask(:, :, Nz/2) = 1;&#60;/p&#62;
&#60;p&#62;        % store y axis properties&#60;br /&#62;
        Nj = Ny;&#60;br /&#62;
        j_vec = kgrid.y_vec;&#60;br /&#62;
        j_label = 'y';&#60;/p&#62;
&#60;p&#62;    case 'xz'&#60;br /&#62;
        % define mask&#60;br /&#62;
        sensor.mask(:, Ny/2, :) = 1;&#60;/p&#62;
&#60;p&#62;        % store z axis properties&#60;br /&#62;
        Nj = Nz;&#60;br /&#62;
        j_vec = kgrid.z_vec;&#60;br /&#62;
        j_label = 'z';&#60;/p&#62;
&#60;p&#62;end &#60;/p&#62;
&#60;p&#62;% set the record mode such that only the rms and peak values are stored&#60;br /&#62;
if USE_STATISTICS&#60;br /&#62;
    sensor.record_mode = 'statistics';&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% RUN THE SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% set the input settings&#60;br /&#62;
input_args = {'DisplayMask', transducer.all_elements_mask, ...&#60;br /&#62;
    'PMLInside', false, 'PlotPML', true, 'PMLSize', [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...&#60;br /&#62;
    'DataCast', DATA_CAST, 'PlotScale', [-source_strength/2, source_strength/2]};&#60;/p&#62;
&#60;p&#62;% input_args = {'DisplayMask', transducer.all_elements_mask, ...&#60;br /&#62;
%     'PMLInside', false, 'PlotPML', false, ...&#60;br /&#62;
%     'DataCast', DATA_CAST, 'PlotScale', [-source_strength/2, source_strength/2]};&#60;br /&#62;
% stream the data to disk in blocks of 100 if storing the complete time&#60;br /&#62;
% history&#60;br /&#62;
if ~USE_STATISTICS&#60;br /&#62;
    input_args = [input_args {'StreamToDisk', 100}];&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
[sensor_data] = kspaceFirstOrder3D(kgrid, medium, transducer, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% COMPUTE THE BEAM PATTERN USING SIMULATION STATISTICS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;if USE_STATISTICS&#60;br /&#62;
    % reshape the returned rms and max fields to their original position&#60;br /&#62;
    sensor_data.p_rms = reshape(sensor_data.p_rms, [Nx, Nj]);&#60;br /&#62;
    sensor_data.p_max = reshape(sensor_data.p_max, [Nx, Nj]);&#60;/p&#62;
&#60;p&#62;    % plot the beam pattern using the pressure maximum&#60;br /&#62;
    figure;&#60;br /&#62;
    imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, sensor_data.p_max/1e6);&#60;br /&#62;
    xlabel([j_label '-position [mm]']);&#60;br /&#62;
    ylabel('x-position [mm]');&#60;br /&#62;
    title('Total Beam Pattern Using Maximum Of Recorded Pressure');&#60;br /&#62;
    colormap(jet(256));&#60;br /&#62;
    c = colorbar;&#60;br /&#62;
    ylabel(c, 'Pressure [MPag]');&#60;br /&#62;
    axis image;&#60;/p&#62;
&#60;p&#62;    % plot the beam pattern using the pressure rms&#60;br /&#62;
    figure;&#60;br /&#62;
    imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, sensor_data.p_rms/1e6);&#60;br /&#62;
    xlabel([j_label '-position [mm]']);&#60;br /&#62;
    ylabel('x-position [mm]');&#60;br /&#62;
    title('Total Beam Pattern Using RMS Of Recorded Pressure');&#60;br /&#62;
    colormap(jet(256));&#60;br /&#62;
    c = colorbar;&#60;br /&#62;
    ylabel(c, 'Pressure [MPag]');&#60;br /&#62;
    axis image;&#60;/p&#62;
&#60;p&#62;    % end the example&#60;br /&#62;
    return&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% COMPUTE THE BEAM PATTERN FROM THE AMPLITUDE SPECTRUM&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% reshape the sensor data to its original position so that it can be&#60;br /&#62;
% indexed as sensor_data(x, j, t)&#60;br /&#62;
sensor_data = reshape(sensor_data, [Nx, Nj, length(kgrid.t_array)]);&#60;/p&#62;
&#60;p&#62;% compute the frequency axis&#60;br /&#62;
freq = (0:ceil((kgrid.Nt + 1)/2) - 1) ./ (kgrid.dt*length(kgrid.t_array));&#60;/p&#62;
&#60;p&#62;% compute the index at which the source frequency and its harmonics occur&#60;br /&#62;
[f0_value, f0_index] = findClosest(freq, tone_burst_freq);&#60;br /&#62;
[f1_value, f1_index] = findClosest(freq, tone_burst_freq*2);&#60;/p&#62;
&#60;p&#62;% preallocate the beam pattern variables&#60;br /&#62;
beam_pattern_f0 = zeros(Nx, Nj);&#60;br /&#62;
beam_pattern_f1 = zeros(Nx, Nj);&#60;br /&#62;
beam_pattern_total = zeros(Nx, Nj);&#60;/p&#62;
&#60;p&#62;% compute the amplitude spectrum of the time series recorded at each sensor&#60;br /&#62;
% point, and then extract the corresponding amplitudes at the fundamental&#60;br /&#62;
% frequency and second harmonic.&#60;br /&#62;
for x_index = 1:Nx&#60;br /&#62;
    for j_index = 1:Nj&#60;/p&#62;
&#60;p&#62;        % compute the amplitude spectrum&#60;br /&#62;
        amp_spect = spectrum(squeeze(sensor_data(x_index, j_index, :)), 1/kgrid.dt); %, 'Window', 'Hanning');&#60;/p&#62;
&#60;p&#62;        % extract the amplitude at the source frequency and store&#60;br /&#62;
        beam_pattern_f0(x_index, j_index) = amp_spect(f0_index);&#60;/p&#62;
&#60;p&#62;        % extract the amplitude at the source frequency and store&#60;br /&#62;
        beam_pattern_f1(x_index, j_index) = amp_spect(f1_index);       &#60;/p&#62;
&#60;p&#62;        % extract the integral of the total amplitude spectrum&#60;br /&#62;
        beam_pattern_total(x_index, j_index) = sum(amp_spect(:));&#60;/p&#62;
&#60;p&#62;    end&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;figure;&#60;br /&#62;
imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, beam_pattern_f0/1e6);&#60;br /&#62;
xlabel([j_label '-position [mm]']);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
title('Beam Pattern At Source Fundamental');&#60;br /&#62;
colormap(jet(256));&#60;br /&#62;
c = colorbar;&#60;br /&#62;
ylabel(c, 'Pressure [MPa]');&#60;br /&#62;
axis image;&#60;/p&#62;
&#60;p&#62;figure;&#60;br /&#62;
imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, beam_pattern_f1/1e3);&#60;br /&#62;
xlabel([j_label '-position [mm]']);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
title('Beam Pattern At Second Harmonic');&#60;br /&#62;
colormap(jet(256));&#60;br /&#62;
c = colorbar;&#60;br /&#62;
ylabel(c, 'Pressure [kPa]');&#60;br /&#62;
axis image;&#60;/p&#62;
&#60;p&#62;figure;&#60;br /&#62;
imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, beam_pattern_total/1e6);&#60;br /&#62;
xlabel([j_label '-position [mm]']);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
title('Total Beam Pattern Using Integral Of Recorded Pressure');&#60;br /&#62;
colormap(jet(256));&#60;br /&#62;
c = colorbar;&#60;br /&#62;
ylabel(c, 'Pressure [MPa]');&#60;br /&#62;
axis image;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% PLOT DIRECTIVITY PATTERN AT FOCUS&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% compute the directivity at each of the harmonics&#60;br /&#62;
directivity_f0 = squeeze(beam_pattern_f0(round(transducer.focus_distance/dx), :));&#60;br /&#62;
directivity_f1 = squeeze(beam_pattern_f1(round(transducer.focus_distance/dx), :));&#60;/p&#62;
&#60;p&#62;% normalise&#60;br /&#62;
directivity_f0 = directivity_f0./max(directivity_f0(:));&#60;br /&#62;
directivity_f1 = directivity_f1./max(directivity_f1(:));&#60;/p&#62;
&#60;p&#62;% compute relative angles from transducer&#60;br /&#62;
if strcmp(MASK_PLANE, 'xy')&#60;br /&#62;
    horz_axis = ((1:Ny) - Ny/2)*dy;&#60;br /&#62;
else&#60;br /&#62;
    horz_axis = ((1:Nz) - Nz/2)*dz;&#60;br /&#62;
end&#60;br /&#62;
angles = 180*atan2(horz_axis, transducer.focus_distance)/pi;&#60;/p&#62;
&#60;p&#62;% plot the directivity&#60;br /&#62;
figure;&#60;br /&#62;
plot(angles, directivity_f0, 'k-', angles, directivity_f1, 'k--');&#60;br /&#62;
axis tight;&#60;br /&#62;
set(gca, 'FontSize', 12);&#60;br /&#62;
xlabel('Angle [deg]');&#60;br /&#62;
ylabel('Normalised Amplitude');&#60;br /&#62;
legend('Fundamental', 'Second Harmonic', 'Location', 'NorthWest');&#60;/p&#62;
&#60;p&#62;_____________________________________________________________________&#60;/p&#62;
&#60;p&#62;However, after some time, in the animation charts, waves from the transducer disappear; but my signal is a continuos sinusoidal, so I don't understand why they stop to exit from transducer..&#60;/p&#62;
&#60;p&#62;Here is a picture:&#60;br /&#62;
&#60;a href=&#34;http://imageshack.us/photo/my-images/718/48364580.png&#34; rel=&#34;nofollow&#34;&#62;http://imageshack.us/photo/my-images/718/48364580.png&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Can you explain me please?&#60;/p&#62;
&#60;p&#62;Thank you,&#60;/p&#62;
&#60;p&#62;Daniele
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ghost82 on "Input signal for ultrasound simulation"</title>
			<link>http://www.k-wave.org/forum/topic/input-signal-for-ultrasound-simulation#post-278</link>
			<pubDate>Fri, 20 Jan 2012 13:50:02 +0000</pubDate>
			<dc:creator>ghost82</dc:creator>
			<guid isPermaLink="false">278@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
my name is Daniele. I found and downloaded k-wave just yestarday and the first thing I can say is that this is a great toolbox :)&#60;br /&#62;
Now, if you can provide me some more information to solve my doubts I will be very greatful.&#60;br /&#62;
Premise: I'm quite new to matlab..&#60;/p&#62;
&#60;p&#62;I want to simulate an ultrasound transducer, 1 element, in water medium; I studied the US example (example_us_beam_patterns) and I have a few questions:&#60;/p&#62;
&#60;p&#62;1) My input signal for the transducer, as shown in scientific literature is: P0-Pa*sin(2*pi*f*t), where P0 is the atmospheric pressure, Pa is the Pressure amplitude, f the frequence, t the time. In the example I think that I have understand that the signal is generated by toneburst, and the signal amplitude always range from -1 to 1; then this pressure signal is converted in velocity units;&#60;br /&#62;
What is the source_strength? Is it my &#34;Pa&#34; &#34;Pressure amplitude&#34;?&#60;br /&#62;
I think there is also an error in the comments as this &#34;source_strength&#34; maybe expressed in Pascal, not MPa.&#60;br /&#62;
Is it for me, the following signal source input ok?&#60;/p&#62;
&#60;p&#62;input_signal = 0-sin(2*pi*freq*kgrid.t_array);&#60;br /&#62;
input_signal = (source_strength./(medium.sound_speed*medium.density)).*input_signal;&#60;/p&#62;
&#60;p&#62;where freq is the ultrasonic frequency (25 kHz) and source_strength is my Pressure amplitude of 240000 (Pa)&#60;/p&#62;
&#60;p&#62;2) I don't understand why there are these lines in the script:&#60;br /&#62;
% set the size of the perfectly matched layer (PML)&#60;br /&#62;
PML_X_SIZE = 20;            % [grid points]&#60;br /&#62;
PML_Y_SIZE = 10;            % [grid points]&#60;br /&#62;
PML_Z_SIZE = 10;            % [grid points]&#60;/p&#62;
&#60;p&#62;So I commented them, modified the total number of grid points without subtracting PML grid points, and modified the input_args.&#60;/p&#62;
&#60;p&#62;Can you explain me the meaning of defining a PML?I thought to create only a domain with PML boundaries applied to the edges of my domain.&#60;/p&#62;
&#60;p&#62;3) When the total beam pattern charts are displayed at the end of the simulation I read on the coloured bar (MPa); however I think that the correct unit is MPa gauge: Am I right?So when I read 0 absolute pressure is atmospheric pressure in my case.&#60;/p&#62;
&#60;p&#62;Thank you very much for reading,&#60;br /&#62;
and I still write that this is a very good toolbox.&#60;br /&#62;
Thank you,&#60;/p&#62;
&#60;p&#62;Daniele
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
