<?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: Long range ultrsonic sensor settings</title>
		<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 02:35:13 +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/long-range-ultrsonic-sensor-settings" rel="self" type="application/rss+xml" />

		<item>
			<title>JoanOS on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6108</link>
			<pubDate>Wed, 23 Aug 2017 11:50:10 +0000</pubDate>
			<dc:creator>JoanOS</dc:creator>
			<guid isPermaLink="false">6108@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you  Brad for your help. It helped alot,&#60;/p&#62;
&#60;p&#62;Joan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6099</link>
			<pubDate>Sun, 06 Aug 2017 15:05:52 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6099@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Joan,&#60;/p&#62;
&#60;p&#62;There are some details on how to index the source and sensor data in the k-Wave manual (see Sec. 3.4) and the &#34;Using A Binary Sensor Mask Example&#34;. If you have just a single element, then you can just average over all of the data, e.g.,&#60;/p&#62;
&#60;p&#62;&#60;code&#62;avg_data = mean(sensor_data.p, 1)&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Regarding the signal at the beginning, it certainly looks like the same issue mentioned in that post. Each element of the disc will record the signal being emitted from all the other elements in the disc.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JoanOS on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6078</link>
			<pubDate>Thu, 27 Jul 2017 17:24:09 +0000</pubDate>
			<dc:creator>JoanOS</dc:creator>
			<guid isPermaLink="false">6078@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Apart from my last post, I am receiving another unwanted behaviour. The picture of the problem is shown in the link below&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://drive.google.com/file/d/0B0SPu9VY8bf8SC1KSGFlVDFjLUU/view?usp=sharing&#34; rel=&#34;nofollow&#34;&#62;https://drive.google.com/file/d/0B0SPu9VY8bf8SC1KSGFlVDFjLUU/view?usp=sharing&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I checked the Kwave manual and I supposed it was because the way I defined the input signal(2.8 Smoothing and the Band-Limited Interpolant) &#60;/p&#62;
&#60;p&#62;I changed it and I used the function toneburst, but I still having the same issue.&#60;/p&#62;
&#60;p&#62;HERE BELOW THE ENTIRE CODE (some external functions not included, please ask if required): &#60;/p&#62;
&#60;p&#62;clear all;&#60;br /&#62;
obstacles_on=1;   %For faster simulation without obstacles obstacles=0;&#60;br /&#62;
walls_on=0;&#60;/p&#62;
&#60;p&#62;% select which code to run&#60;br /&#62;
%   1: MATLAB CPU code with animation&#60;br /&#62;
%   2: MATLAB CUDA GPU code acceleration. Without animation and much more faster.&#60;br /&#62;
%   3: C++ code&#60;br /&#62;
MODEL           = 3;&#60;/p&#62;
&#60;p&#62;T=20;   %Degree&#60;br /&#62;
P=1;    %atm&#60;/p&#62;
&#60;p&#62;% set the PML size&#60;br /&#62;
PML_size = 20;&#60;/p&#62;
&#60;p&#62;% scale parameter (changes the resolution of the simulation)&#60;/p&#62;
&#60;p&#62;SC=1;                     %Resolution&#60;/p&#62;
&#60;p&#62;% create the computational grid [ 3m by 3m domain ]&#60;br /&#62;
Nx = 256*SC - 2*PML_size; % number of grid points in the x (row) direction&#60;br /&#62;
Ny = 128*SC - 2*PML_size; % number of grid points in the y (column) direction&#60;br /&#62;
Nz=  128*SC - 2*PML_size;&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
[c_air,rho_air]=air_prop(T,P); % [m/s] and [kg/m^3]&#60;/p&#62;
&#60;p&#62;thickness = 5; % [grid points] of the walls. Used in different positioning commands&#60;/p&#62;
&#60;p&#62;F0              = 50e3;                    % source frequency [Hz]&#60;br /&#62;
SOURCE_MAG      = 40;                      % source pressure [Pa]&#60;/p&#62;
&#60;p&#62;dx = c_air/(3*F0); % grid point spacing in the x direction [m]&#60;br /&#62;
dy = dx;           % grid point spacing in the y direction [m]&#60;br /&#62;
dz = dx;&#60;/p&#62;
&#60;p&#62;kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);&#60;/p&#62;
&#60;p&#62;SOURCE_RADIUS   = (39/2)*1e-3 ;            % piston radius [m]&#60;br /&#62;
SOURCE_RADIUS_m =(39/2)*1e-3 ;&#60;br /&#62;
SOURCE_RADIUS   = round(SOURCE_RADIUS/dx); % piston radius [grid points]&#60;/p&#62;
&#60;p&#62;max_distance=dx*Nx;&#60;/p&#62;
&#60;p&#62;%define the obstacle matrix&#60;br /&#62;
obst = zeros(Nx, Ny, Nz);&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%%--------------------------------WALLS------------------------------------&#60;br /&#62;
if walls_on==1&#60;br /&#62;
    %For time definition&#60;br /&#62;
    obst_sensor_distance_meters = 15;                            %[m]&#60;br /&#62;
    obst_sensor_distance=round(obst_sensor_distance_meters/dx); % [grid points] M&#60;/p&#62;
&#60;p&#62;    % define the properties of the wall&#60;br /&#62;
    c_wall = 3200; % [m/s] concrete walls&#60;br /&#62;
    rho_wall = 2300; % [kg/m^3]&#60;br /&#62;
    thickness = 5; % [grid points]&#60;/p&#62;
&#60;p&#62;    % define the position of the wall&#60;br /&#62;
    obst(1:thickness, :,:) = 1;&#60;br /&#62;
    obst(end - thickness + 1:end, :,:) = 1;&#60;br /&#62;
    obst(:, 1:thickness,:) = 1;&#60;br /&#62;
    obst(:, end - thickness + 1:end,:) = 1;&#60;br /&#62;
    obst(:, :, 1:thickness) = 1;&#60;br /&#62;
    obst(:, :, end - thickness + 1:end) = 1;&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%%-------------------------------OBSTACLE----------------------------------&#60;br /&#62;
if obstacles_on==1&#60;/p&#62;
&#60;p&#62;    % Import Obstacle. Shape, c_obst, rho_obs&#60;br /&#62;
    [obstacle_import,c_obs,rho_obs]=cube(dx,dy,dz);&#60;/p&#62;
&#60;p&#62;    % define the position of the obstacle&#60;br /&#62;
    obst_sensor_distance_meters = 0.4;                          %[m]&#60;br /&#62;
    obst_sensor_distance=round(obst_sensor_distance_meters/dx); % [grid points] Must be an integer. Resolution depends of dx&#60;br /&#62;
    [x,y,z]=size(obstacle_import);&#60;br /&#62;
    obstacle_import=2*obstacle_import;                          %Distinguish between walls and obstacles&#60;br /&#62;
    CP=[25+obst_sensor_distance Ny/2 Nz/2];                     %centering point&#60;br /&#62;
    SP=round([CP(1) CP(2)-y/2 CP(3)-z/2]);                      %starting point. &#60;/p&#62;
&#60;p&#62;    for i=1:x&#60;br /&#62;
        for j=1:y&#60;br /&#62;
            for k=1:z&#60;br /&#62;
                obst(SP(1)-1+i,SP(2)-1+j,SP(3)-1+k)=obstacle_import(i,j,k);&#60;br /&#62;
            end&#60;br /&#62;
        end&#60;br /&#62;
    end&#60;/p&#62;
&#60;p&#62;end&#60;br /&#62;
%--------------------------------------------------------------------------&#60;br /&#62;
%--------------------------------------------------------------------------&#60;br /&#62;
% assign the medium properties&#60;br /&#62;
medium.sound_speed = c_air*ones(Nx, Ny, Nz);&#60;br /&#62;
medium.density = rho_air*ones(Nx, Ny, Nz);&#60;/p&#62;
&#60;p&#62;if walls_on==1&#60;br /&#62;
    medium.sound_speed(obst == 1) = c_wall;&#60;br /&#62;
    medium.density(obst == 1) = rho_wall;&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;if obstacles_on==1&#60;br /&#62;
    medium.sound_speed(obst ==2)=c_obs;&#60;br /&#62;
    medium.density(obst == 2) = rho_obs;&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;%if I use rho_obs as the difference between rho_obs and rho_air is so high an error occurs.&#60;br /&#62;
%This is solved decreasing cfl. Check paper Modeling nonlinear ultrasound propagation in heterogeneous&#60;br /&#62;
%media with power law absorption using a k-space pseudospectral method&#60;br /&#62;
%(folder, readings--&#38;gt; others)&#60;/p&#62;
&#60;p&#62;% set the reference sound speed used in the k-space operator&#60;br /&#62;
medium.sound_speed_ref = c_air;&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
cfl = 0.05; %  Courant-Friedrichs-Lewy stability level cfl&#60;br /&#62;
%---&#60;br /&#62;
%t_end = 50e-3; % [s]&#60;br /&#62;
t_end=(2*obst_sensor_distance_meters*1.1)/medium.sound_speed_ref; %Time enough to detect the obstacle.&#60;br /&#62;
%---&#60;br /&#62;
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed, cfl, t_end);&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%%-----------------------------Transmitter---------------------------------&#60;br /&#62;
piston = makeDisc(Ny, Nz, Ny/2, Nz/2, SOURCE_RADIUS);&#60;br /&#62;
source.p_mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
source.p_mask(25, :, :) = piston;&#60;/p&#62;
&#60;p&#62;% create time varying source&#60;/p&#62;
&#60;p&#62;t_length=size(kgrid.t_array,2);&#60;br /&#62;
DC=2;   %DUTY CYCLE [%]&#60;br /&#62;
sample_freq=20e6;&#60;br /&#62;
source.p = SOURCE_MAG*toneBurst(sample_freq, F0, 10); %Actually,The number of cycles depends on the DUTY CYCLE.&#60;/p&#62;
&#60;p&#62;figure;&#60;br /&#62;
plot(kgrid.t_array(1:length(source.p)), source.p,'r');&#60;br /&#62;
set(gca, 'XLim', [0, t_end]);&#60;br /&#62;
title('input');&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%%-----------------------------Receiver------------------------------------&#60;br /&#62;
% define a single sensor point&#60;br /&#62;
sensor.mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
%sensor.mask(1, :, :)=piston;&#60;br /&#62;
sensor.mask(25, :, :) = piston;&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%---------------------------Scenario representation------------------------&#60;br /&#62;
%obstacle=obst./2;&#60;br /&#62;
% voxelPlot(source.p_mask+obstacle,'Transparency',0.8);&#60;br /&#62;
%--------------------------------------------------------------------------&#60;br /&#62;
%%----------------------------SIMULATION-----------------------------------&#60;/p&#62;
&#60;p&#62;% define the acoustic parameters to record&#60;br /&#62;
sensor.record = {'p'}; % Pressure, check KspaceFirstOrder2D for more&#60;br /&#62;
% run code&#60;br /&#62;
switch MODEL&#60;br /&#62;
    case 1&#60;br /&#62;
        % MATLAB CPU&#60;br /&#62;
        sensor_data = kspaceFirstOrder3D(kgrid, medium, source, sensor, ...&#60;br /&#62;
    'PMLInside', false, 'PlotPML', false, 'PMLSize', PML_size,'PlotLayout',false, ...&#60;br /&#62;
    'DisplayMask', 'off', 'PlotScale', [-0.25, 0.25]*SOURCE_MAG,'PlotSim',false,...&#60;br /&#62;
    'DataCast', 'single');&#60;br /&#62;
    case 2&#60;br /&#62;
        % MATLAB GPU&#60;br /&#62;
        sensor_data = kspaceFirstOrder3DG(kgrid, medium, source, sensor, ...&#60;br /&#62;
            'DataCast', 'single', 'PMLInside', false, ...&#60;br /&#62;
            'DisplayMask', source.p_mask, 'PlotScale', [-1, 1]*SOURCE_MAG);&#60;br /&#62;
    case 3&#60;br /&#62;
        % C++&#60;br /&#62;
        sensor_data = kspaceFirstOrder3DC(kgrid, medium, source, sensor, 'PMLInside', false);&#60;br /&#62;
end&#60;br /&#62;
%%=========================================================================&#60;br /&#62;
%                               POST PROCESS&#60;br /&#62;
%==========================================================================&#60;/p&#62;
&#60;p&#62;%%-------------------------------PLOTS-------------------------------------&#60;br /&#62;
%plot the recorded data&#60;br /&#62;
figure;&#60;br /&#62;
plot(kgrid.t_array(1:length(source.p)), source.p,'r');&#60;br /&#62;
set(gca, 'XLim', [0, t_end]);&#60;br /&#62;
title('input');&#60;/p&#62;
&#60;p&#62;hold on&#60;br /&#62;
plot(kgrid.t_array, sensor_data.p(125,:));&#60;br /&#62;
set(gca, 'XLim', [0, t_end]);&#60;/p&#62;
&#60;p&#62;title('Test');&#60;br /&#62;
xlabel('Time[s]','fontweight','bold','Fontsize',12) % x-axis label&#60;br /&#62;
ylabel('Pa','fontweight','bold','Fontsize',12) % y-axis label&#60;br /&#62;
k_legend=legend('Transmitted','Received','Location','Best');&#60;br /&#62;
grid on&#60;/p&#62;
&#60;p&#62;writetxt_matrix(sensor_data.p)&#60;br /&#62;
save simu3.mat sensor_data&#60;/p&#62;
&#60;p&#62;I think the description of the problem is the same as this one:&#60;br /&#62;
&#60;a href=&#34;http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4783&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org/forum/topic/image-artefacts-ultrasound-imaging#post-4783&#60;/a&#62;&#60;br /&#62;
but I am not sure it is because the signal from other elements of the transducers. &#60;/p&#62;
&#60;p&#62;I would really appreciate your help, &#60;/p&#62;
&#60;p&#62;Joan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JoanOS on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6072</link>
			<pubDate>Tue, 25 Jul 2017 13:04:45 +0000</pubDate>
			<dc:creator>JoanOS</dc:creator>
			<guid isPermaLink="false">6072@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bradley. Thank you for your answer. &#60;/p&#62;
&#60;p&#62;I have a question related this simulation. I have created the transducer using the function &#34;makeDisc&#34;. I would like to use &#34;piston&#34; as a sensor as well to measure the echo received.&#60;/p&#62;
&#60;p&#62;I have read in the example &#34;using an ultrasound transducer as sensor example&#34; that :&#34;using a sensor mask containing the grid points for each transducer element, and then averaging the recorded pressure signals over the appropriate grid elements after the simulation is complete&#34;&#60;/p&#62;
&#60;p&#62;As I am really interested in the circular transducer, so I wouldn't like to use the &#34;transducer&#34; object, my questions are: &#60;/p&#62;
&#60;p&#62;-How sensor data index the elements of the object piston? I mean, sensor data is saved in rows=nºelements columns: time. In my case, &#34;piston&#34; has x and Y dimensions, so, how the position of each element is stored in sensor data?&#60;/p&#62;
&#60;p&#62;-How should average the data recorded (&#34;averaging the recorded pressure signals over the appropriate grid element&#34;)? &#60;/p&#62;
&#60;p&#62;Thank you,&#60;/p&#62;
&#60;p&#62;Joan&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%%-----------------------------Transmitter---------------------------------&#60;br /&#62;
piston = makeDisc(Ny, Nz, Ny/2, Nz/2, SOURCE_RADIUS);&#60;br /&#62;
source.p_mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
source.p_mask(25, :, :) = piston;&#60;/p&#62;
&#60;p&#62;% create time varying source&#60;br /&#62;
t_length=size(kgrid.t_array,2);&#60;br /&#62;
DC=2;   %DUTY CYCLE [%]&#60;br /&#62;
source.p = SOURCE_MAG * sin(2*pi*F0*kgrid.t_array);&#60;br /&#62;
source.p(round(t_length*(DC/100)):end) = 0;&#60;/p&#62;
&#60;p&#62;%--------------------------------------------------------------------------&#60;br /&#62;
%%-----------------------------Receiver------------------------------------&#60;br /&#62;
sensor.mask = zeros(Nx, Ny, Nz);&#60;br /&#62;
sensor.mask(25, :, :) = piston;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6066</link>
			<pubDate>Fri, 21 Jul 2017 14:01:54 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6066@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Joan,&#60;/p&#62;
&#60;p&#62;You should start by using at least 3 points per wavelength at the source frequency (see section 3.2 in the k-Wave manual for more details). This will give a value for dx/dy/dz. You can then specific Nx/Ny/Nz to give you the desired domain size. After that, I would run a convergence test. That is, keep reducing the values of dx, dy, dx (increasing Nx, Ny, Nz) until the answer doesn't change any more.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JoanOS on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6049</link>
			<pubDate>Fri, 07 Jul 2017 19:12:05 +0000</pubDate>
			<dc:creator>JoanOS</dc:creator>
			<guid isPermaLink="false">6049@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;By the way, My code is based on this example: &#60;a href=&#34;http://www.k-wave.org/downloads/example_circular_piston.m&#34; rel=&#34;nofollow&#34;&#62;http://www.k-wave.org/downloads/example_circular_piston.m&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Thank you in advance,&#60;/p&#62;
&#60;p&#62;Joan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JoanOS on "Long range ultrsonic sensor settings"</title>
			<link>http://www.k-wave.org/forum/topic/long-range-ultrsonic-sensor-settings#post-6046</link>
			<pubDate>Fri, 07 Jul 2017 13:16:20 +0000</pubDate>
			<dc:creator>JoanOS</dc:creator>
			<guid isPermaLink="false">6046@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I am trying to simulate long range ultrasonic sensors (Around 15 m). I would like to put an obstacle in front of it at that distance at 13 m for instance and observe the response.&#60;/p&#62;
&#60;p&#62;These kind of transducers operates at 50 khz more or less. The medium is air (c=340 m/s). &#60;/p&#62;
&#60;p&#62;Usually this transducers (circular pistons) have a Diameter of 77.5 mm. &#60;/p&#62;
&#60;p&#62;My question is, which values should I give to Nx, Ny, Nz and Dx Dy Dz in order to simulate it and achieve good results?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
