<?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: Source Positioning</title>
		<link>http://www.k-wave.org/forum/topic/source-positioning</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:06:49 +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/source-positioning" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "Source Positioning"</title>
			<link>http://www.k-wave.org/forum/topic/source-positioning#post-6420</link>
			<pubDate>Wed, 18 Apr 2018 09:19:53 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6420@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi cahyakirana,&#60;/p&#62;
&#60;p&#62;If you're running simulations in 2D, take a look at the &#60;code&#62;makeMultiArc&#60;/code&#62; function, it should do what you need.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cahyakirana on "Source Positioning"</title>
			<link>http://www.k-wave.org/forum/topic/source-positioning#post-6406</link>
			<pubDate>Wed, 11 Apr 2018 11:46:37 +0000</pubDate>
			<dc:creator>cahyakirana</dc:creator>
			<guid isPermaLink="false">6406@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;hello,&#60;/p&#62;
&#60;p&#62;i'm super new to this toolbox, and i need to simulate 20 transducers to see the field pattern based on the transducers' configuration (e.g 5 x 4 arrays or bee-hive configuration). how can i assign the position of each transducer? thank you.&#60;/p&#62;
&#60;p&#62;% Simulating Transducer Field Patterns Example&#60;br /&#62;
%&#60;br /&#62;
% This example demonstrates the use of k-Wave to compute the field pattern&#60;br /&#62;
% generated by a curved single element transducer in two dimensions. It&#60;br /&#62;
% builds on the Monopole Point Source In A Homogeneous Propagation Medium&#60;br /&#62;
% Example.&#60;br /&#62;
%&#60;br /&#62;
% author: Bradley Treeby&#60;br /&#62;
% date: 10th December 2009&#60;br /&#62;
% last update: 4th May 2017&#60;br /&#62;
%&#60;br /&#62;
% This function is part of the k-Wave Toolbox (&#60;a href=&#34;http://www.k-wave.org&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org&#60;/a&#62;)&#60;br /&#62;
% Copyright (C) 2009-2017 Bradley Treeby&#60;/p&#62;
&#60;p&#62;% This file is part of k-Wave. k-Wave is free software: you can&#60;br /&#62;
% redistribute it and/or modify it under the terms of the GNU Lesser&#60;br /&#62;
% General Public License as published by the Free Software Foundation,&#60;br /&#62;
% either version 3 of the License, or (at your option) any later version.&#60;br /&#62;
%&#60;br /&#62;
% k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY&#60;br /&#62;
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS&#60;br /&#62;
% FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for&#60;br /&#62;
% more details.&#60;br /&#62;
%&#60;br /&#62;
% You should have received a copy of the GNU Lesser General Public License&#60;br /&#62;
% along with k-Wave. If not, see &#38;lt;http://www.gnu.org/licenses/&#38;gt;. &#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;
Nx = 216;           % number of grid points in the x (row) direction&#60;br /&#62;
Ny = 216;           % number of grid points in the y (column) direction&#60;br /&#62;
dx = 50e-3/Nx;    	% grid point spacing in the x direction [m]&#60;br /&#62;
dy = dx;            % grid point spacing in the y direction [m]&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 1500;  % [m/s]&#60;br /&#62;
medium.alpha_coeff = 0.75;  % [dB/(MHz^y cm)]&#60;br /&#62;
medium.alpha_power = 1.5;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
kgrid.makeTime(medium.sound_speed);&#60;/p&#62;
&#60;p&#62;% define a curved transducer element&#60;br /&#62;
cx = ;&#60;br /&#62;
cy = ;&#60;br /&#62;
radius = 10;&#60;br /&#62;
source.p_mask = makeDisc(Nx, Ny, cx, cy, radius, 'true');&#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 = 0.5;           % [Pa]&#60;br /&#62;
source.p = source_mag * sin(2 * pi * source_freq * kgrid.t_array);&#60;/p&#62;
&#60;p&#62;% filter the source to remove high frequencies not supported by the grid&#60;br /&#62;
source.p = filterTimeSeries(kgrid, medium, source.p);&#60;/p&#62;
&#60;p&#62;% create a display mask to display the transducer&#60;br /&#62;
display_mask = source.p_mask;&#60;/p&#62;
&#60;p&#62;% create a sensor mask covering the entire computational domain using the&#60;br /&#62;
% opposing corners of a rectangle&#60;br /&#62;
sensor.mask = [1, 1, Nx, Ny].';&#60;/p&#62;
&#60;p&#62;% set the record mode capture the final wave-field and the statistics at&#60;br /&#62;
% each sensor point&#60;br /&#62;
sensor.record = {'p_final', 'p_max', 'p_rms'};&#60;/p&#62;
&#60;p&#62;% assign the input options&#60;br /&#62;
input_args = {'DisplayMask', display_mask, 'PMLInside', false, 'PlotPML', false};&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% add the source mask onto the recorded wave-field&#60;br /&#62;
sensor_data.p_final(source.p_mask ~= 0) = 1;&#60;br /&#62;
sensor_data.p_max(source.p_mask ~= 0) = 1;&#60;br /&#62;
sensor_data.p_rms(source.p_mask ~= 0) = 1;&#60;/p&#62;
&#60;p&#62;% plot the final wave-field&#60;br /&#62;
figure;&#60;br /&#62;
subplot(1, 3, 1);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, sensor_data.p_final, [-1 1]);&#60;br /&#62;
colormap(getColorMap);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Final Wave Field');&#60;/p&#62;
&#60;p&#62;% plot the maximum recorded pressure&#60;br /&#62;
subplot(1, 3, 2);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, sensor_data.p_max, [-1 1]);&#60;br /&#62;
colormap(getColorMap);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Maximum Pressure');&#60;/p&#62;
&#60;p&#62;% plot the rms recorded pressure&#60;br /&#62;
subplot(1, 3, 3);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, sensor_data.p_rms, [-1 1]);&#60;br /&#62;
colormap(getColorMap);&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('RMS Pressure');&#60;br /&#62;
scaleFig(2, 1);
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Source Positioning"</title>
			<link>http://www.k-wave.org/forum/topic/source-positioning#post-4891</link>
			<pubDate>Fri, 12 Dec 2014 12:02:18 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4891@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi gondolio,&#60;/p&#62;
&#60;p&#62;If you don't want to focus the field, just remove the line of code that calls the &#60;code&#62;focus&#60;/code&#62; function, and instead assign the &#60;code&#62;input_signal&#60;/code&#62; directly to &#60;code&#62;source.p&#60;/code&#62;. This will then drive the source aperture with the same signal, without any beamforming delays.&#60;/p&#62;
&#60;p&#62;The parameters &#60;code&#62;medium.alpha_coeff&#60;/code&#62; (a0) and &#60;code&#62;medium.alpha_power&#60;/code&#62; (y) describe the power law acoustic attenuation in the medium, where the attenuation is of the form a = a0*f^y. The parameter &#60;code&#62;medium.BonA&#60;/code&#62; is the nonlinearity parameter.&#60;/p&#62;
&#60;p&#62;For water, these values are given by &#60;code&#62;medium.alpha_coeff = 2.17e-3&#60;/code&#62;, &#60;code&#62;medium.alpha_power = 2&#60;/code&#62;, &#60;code&#62;medium.BonA = 4.96&#60;/code&#62;. In water, at lower frequencies and amplitudes, the attenuation and nonlinearity will only have a small effect on the wave field. At higher frequencies and amplitudes, these effects become more important.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gondolio on "Source Positioning"</title>
			<link>http://www.k-wave.org/forum/topic/source-positioning#post-4876</link>
			<pubDate>Sat, 06 Dec 2014 03:58:58 +0000</pubDate>
			<dc:creator>gondolio</dc:creator>
			<guid isPermaLink="false">4876@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bradley!&#60;/p&#62;
&#60;p&#62;Thank you. That is what I ended up doing, however, I realized that the source I created is focused which I do not want.&#60;/p&#62;
&#60;p&#62;Currently, I am trying to create a source with a pulsed signal that has these parameters:&#60;br /&#62;
&#60;a href=&#34;http://imgur.com/SioqhAe&#34; rel=&#34;nofollow&#34;&#62;http://imgur.com/SioqhAe&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Which results in a beam pattern that looks like this when the medium is water:&#60;br /&#62;
&#60;a href=&#34;http://imgur.com/3aRLw7s&#34; rel=&#34;nofollow&#34;&#62;http://imgur.com/3aRLw7s&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I am attempting to accomplish this using the toneBurst function, but I am not having much luck.&#60;/p&#62;
&#60;p&#62;'% define properties of the input signal&#60;br /&#62;
source_strength = 0.076e6;          % [Pa]&#60;br /&#62;
tone_burst_freq = 1.5e6;    	% [Hz]&#60;br /&#62;
tone_burst_cycles = 32;&#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,'Plot',true,'Envelope','Rectangular','SignalLength',(1/kgrid.dt)*200e-6);&#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./(medium.sound_speed*medium.density)).*input_signal;'&#60;/p&#62;
&#60;p&#62;Do you have any suggestions? I apologize if this is a stupid question, I am very new to this material. Also, when defining the medium, what do medium.alpha_power and medium.BonA refer to and where could I find these values for water?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Source Positioning"</title>
			<link>http://www.k-wave.org/forum/topic/source-positioning#post-4872</link>
			<pubDate>Fri, 05 Dec 2014 17:59:25 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4872@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;A first glance (without having run your code), it looks like your source and sensor are both defined in the x/y plane (facing in the z-dimension). If you want to see a beam profile, then you could try putting the sensor in the x/z plane, or defining your source to face in a different direction.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gondolio on "Source Positioning"</title>
			<link>http://www.k-wave.org/forum/topic/source-positioning#post-4863</link>
			<pubDate>Wed, 03 Dec 2014 06:40:58 +0000</pubDate>
			<dc:creator>gondolio</dc:creator>
			<guid isPermaLink="false">4863@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hey guys, I'm super new to this toolbox and have barely any idea what I'm doing, so bare with me. I am trying to model how ultrasound waves from a single element,circular transducer propagate through skin, tissue, and bone. I originally tried using the makeTransducer function, however, as I've seen from other posts, there are better ways of modeling this. So I am currently using the method where you create a circular source. I think I am having trouble positioning this source so that it resembles the beam patterns created by transducer as in the example_us_beam_patterns file. &#60;/p&#62;
&#60;p&#62;This is what I want it to look like: &#60;a href=&#34;http://imgur.com/NQxiXax&#34; rel=&#34;nofollow&#34;&#62;http://imgur.com/NQxiXax&#60;/a&#62;&#60;br /&#62;
This is the view that I am getting: &#60;a href=&#34;http://imgur.com/13vNmEM&#34; rel=&#34;nofollow&#34;&#62;http://imgur.com/13vNmEM&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Here is my code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% Simulating Ultrasound Beam Patterns Example
%
% This example shows how the nonlinear beam pattern from an ultrasound
% transducer can be modelled. It builds on the Defining An Ultrasound
% Transducer and Simulating Transducer Field Patterns examples.
%
% author: Bradley Treeby
% date: 27th July 2011
% last update: 25th September 2012
%
% This function is part of the k-Wave Toolbox (&#60;a href=&#34;http://www.k-wave.org&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org&#60;/a&#62;)
% Copyright (C) 2009-2014 Bradley Treeby and Ben Cox

% This file is part of k-Wave. k-Wave is free software: you can
% redistribute it and/or modify it under the terms of the GNU Lesser
% General Public License as published by the Free Software Foundation,
% either version 3 of the License, or (at your option) any later version.
%
% k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
% FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
% more details.
%
% You should have received a copy of the GNU Lesser General Public License
% along with k-Wave. If not, see &#38;lt;http://www.gnu.org/licenses/&#38;gt;. 

clear all;

% simulation settings
DATA_CAST = &#38;#39;single&#38;#39;;       % set to &#38;#39;single&#38;#39; or &#38;#39;gpuArray-single&#38;#39; to speed up computations
MASK_PLANE = &#38;#39;xy&#38;#39;;          % set to &#38;#39;xy&#38;#39; or &#38;#39;xz&#38;#39; to generate the beam pattern in different planes
USE_STATISTICS = true;      % set to true to compute the rms or peak beam patterns, set to false to compute the harmonic beam patterns

% =========================================================================
% DEFINE THE K-WAVE GRID
% =========================================================================

% set the size of the perfectly matched layer (PML)
PML_X_SIZE = 20;            % [grid points]
PML_Y_SIZE = 10;            % [grid points]
PML_Z_SIZE = 10;            % [grid points]

% set total number of grid points not including the PML
Nx = 128 - 2*PML_X_SIZE;    % [grid points]
Ny = 256 - 2*PML_Y_SIZE;     % [grid points]
Nz = 64 - 2*PML_Z_SIZE;     % [grid points]

% set desired grid size in the x-direction not including the PML
x = 40e-3;                  % [m]

% calculate the spacing between the grid points
dx = x/Nx;                  % [m]
dy = dx;                    % [m]
dz = dx;                    % [m]

% create the k-space grid
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);

% =========================================================================
% DEFINE THE MEDIUM PARAMETERS
% =========================================================================

% define the properties of the propagation medium
medium.sound_speed = 1540;      % [m/s]
medium.density = 1000;          % [kg/m^3]
medium.alpha_coeff = 0.75;      % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
medium.BonA = 6;

% create the time array
t_end = 45e-6;                  % [s]
kgrid.t_array = makeTime(kgrid, medium.sound_speed, [], t_end);

% =========================================================================
% DEFINE THE INPUT SIGNAL
% =========================================================================

% define properties of the input signal
source_strength = 1e6;          % [Pa]
tone_burst_freq = 0.5e6;    	% [Hz]
tone_burst_cycles = 5;

% define a circular source element
source_radius = 15;  % [grid points]
source_shape  = makeDisc(Nx, Ny, Nx/2, Ny/2, source_radius);

% assign source element to source mask
source_z_pos = 12;  % [grid points]
source.p_mask = zeros(Nx, Ny, Nz);
source.p_mask(:, :, source_z_pos) = source_shape;

% define source input
source_freq = 2e6;  % [Hz]
num_cycles = 5;
source_signal = toneBurst(1/kgrid.dt, source_freq, num_cycles);

% create time delays to focus the transducer and assign to source
focus_position = round([0,0,0]);
source.p = focus(kgrid, source_signal, source.p_mask, focus_position, 1450);

% =========================================================================
% DEFINE SENSOR MASK
% =========================================================================

% define a sensor mask through the central plane
sensor.mask = zeros(Nx, Ny, Nz);
switch MASK_PLANE
    case &#38;#39;xy&#38;#39;
        % define mask
        sensor.mask(:, :, Nz/2) = 1;

        % store y axis properties
        Nj = Ny;
        j_vec = kgrid.y_vec;
        j_label = &#38;#39;y&#38;#39;;

    case &#38;#39;xz&#38;#39;
        % define mask
        sensor.mask(:, Ny/2, :) = 1;

        % store z axis properties
        Nj = Nz;
        j_vec = kgrid.z_vec;
        j_label = &#38;#39;z&#38;#39;;

end 

% set the record mode such that only the rms and peak values are stored
if USE_STATISTICS
    sensor.record = {&#38;#39;p_rms&#38;#39;, &#38;#39;p_max&#38;#39;};
end

% =========================================================================
% RUN THE SIMULATION
% =========================================================================

% set the input settings
input_args = {&#38;#39;DisplayMask&#38;#39;, source.p_mask, ...
    &#38;#39;PMLInside&#38;#39;, false, &#38;#39;PlotPML&#38;#39;, false, &#38;#39;PMLSize&#38;#39;, [PML_X_SIZE, PML_Y_SIZE, PML_Z_SIZE], ...
    &#38;#39;DataCast&#38;#39;, DATA_CAST, &#38;#39;DataRecast&#38;#39;, true, &#38;#39;PlotScale&#38;#39;, [-source_strength/2, source_strength/2]};

% stream the data to disk in blocks of 100 if storing the complete time
% history
if ~USE_STATISTICS
    input_args = [input_args {&#38;#39;StreamToDisk&#38;#39;, 100}];
end

% run the simulation
sensor_data = kspaceFirstOrder3D(kgrid, medium, source, sensor, input_args{:});

% =========================================================================
% COMPUTE THE BEAM PATTERN USING SIMULATION STATISTICS
% =========================================================================

if USE_STATISTICS

    % reshape the returned rms and max fields to their original position
    sensor_data.p_rms = reshape(sensor_data.p_rms, [Nx, Nj]);
    sensor_data.p_max = reshape(sensor_data.p_max, [Nx, Nj]);

    % plot the beam pattern using the pressure maximum
    figure;
    imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, sensor_data.p_max/1e6);
    xlabel([j_label &#38;#39;-position [mm]&#38;#39;]);
    ylabel(&#38;#39;x-position [mm]&#38;#39;);
    title(&#38;#39;Total Beam Pattern Using Maximum Of Recorded Pressure&#38;#39;);
    colormap(jet(256));
    c = colorbar;
    ylabel(c, &#38;#39;Pressure [MPa]&#38;#39;);
    axis image;

    % plot the beam pattern using the pressure rms
    figure;
    imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, sensor_data.p_rms/1e6);
    xlabel([j_label &#38;#39;-position [mm]&#38;#39;]);
    ylabel(&#38;#39;x-position [mm]&#38;#39;);
    title(&#38;#39;Total Beam Pattern Using RMS Of Recorded Pressure&#38;#39;);
    colormap(jet(256));
    c = colorbar;
    ylabel(c, &#38;#39;Pressure [MPa]&#38;#39;);
    axis image;

    % end the example
    return

end

% =========================================================================
% COMPUTE THE BEAM PATTERN FROM THE AMPLITUDE SPECTRUM
% =========================================================================

% reshape the sensor data to its original position so that it can be
% indexed as sensor_data(x, j, t)
sensor_data = reshape(sensor_data, [Nx, Nj, kgrid.Nt]);

% compute the amplitude spectrum
[freq, amp_spect] = spect(sensor_data, 1/kgrid.dt, &#38;#39;Dim&#38;#39;, 3);

% compute the index at which the source frequency and its harmonics occur
[f1_value, f1_index] = findClosest(freq, tone_burst_freq);
[f2_value, f2_index] = findClosest(freq, tone_burst_freq*2);

% extract the amplitude at the source frequency and store
beam_pattern_f1 = amp_spect(:, :, f1_index);

% extract the amplitude at the second harmonic and store
beam_pattern_f2 = amp_spect(:, :, f2_index);       

% extract the integral of the total amplitude spectrum
beam_pattern_total = sum(amp_spect, 3);

% plot the beam patterns
figure;
imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, beam_pattern_f1/1e6);
xlabel([j_label &#38;#39;-position [mm]&#38;#39;]);
ylabel(&#38;#39;x-position [mm]&#38;#39;);
title(&#38;#39;Beam Pattern At Source Fundamental&#38;#39;);
colormap(jet(256));
c = colorbar;
ylabel(c, &#38;#39;Pressure [MPa]&#38;#39;);
axis image;

figure;
imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, beam_pattern_f2/1e3);
xlabel([j_label &#38;#39;-position [mm]&#38;#39;]);
ylabel(&#38;#39;x-position [mm]&#38;#39;);
title(&#38;#39;Beam Pattern At Second Harmonic&#38;#39;);
colormap(jet(256));
c = colorbar;
ylabel(c, &#38;#39;Pressure [kPa]&#38;#39;);
axis image;

figure;
imagesc(j_vec*1e3, (kgrid.x_vec - min(kgrid.x_vec(:)))*1e3, beam_pattern_total/1e6);
xlabel([j_label &#38;#39;-position [mm]&#38;#39;]);
ylabel(&#38;#39;x-position [mm]&#38;#39;);
title(&#38;#39;Total Beam Pattern Using Integral Of Recorded Pressure&#38;#39;);
colormap(jet(256));
c = colorbar;
ylabel(c, &#38;#39;Pressure [MPa]&#38;#39;);
axis image;

% =========================================================================
% PLOT DIRECTIVITY PATTERN AT FOCUS
% =========================================================================

% compute the directivity at each of the harmonics
directivity_f1 = squeeze(beam_pattern_f1(round(transducer.focus_distance/dx), :));
directivity_f2 = squeeze(beam_pattern_f2(round(transducer.focus_distance/dx), :));

% normalise
directivity_f1 = directivity_f1./max(directivity_f1(:));
directivity_f2 = directivity_f2./max(directivity_f2(:));

% compute relative angles from transducer
if strcmp(MASK_PLANE, &#38;#39;xy&#38;#39;)
    horz_axis = ((1:Ny) - Ny/2)*dy;
else
    horz_axis = ((1:Nz) - Nz/2)*dz;
end
angles = 180*atan2(horz_axis, transducer.focus_distance)/pi;

% plot the directivity
figure;
plot(angles, directivity_f1, &#38;#39;k-&#38;#39;, angles, directivity_f2, &#38;#39;k--&#38;#39;);
axis tight;
set(gca, &#38;#39;FontSize&#38;#39;, 12);
xlabel(&#38;#39;Angle [deg]&#38;#39;);
ylabel(&#38;#39;Normalised Amplitude&#38;#39;);
legend(&#38;#39;Fundamental&#38;#39;, &#38;#39;Second Harmonic&#38;#39;, &#38;#39;Location&#38;#39;, &#38;#39;NorthWest&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Sorry if this doesn't make any sense! Thank you.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
