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

		<item>
			<title>pakulam on "Problem with linear source"</title>
			<link>http://www.k-wave.org/forum/topic/problem-with-linear-source#post-5108</link>
			<pubDate>Mon, 22 Jun 2015 14:43:21 +0000</pubDate>
			<dc:creator>pakulam</dc:creator>
			<guid isPermaLink="false">5108@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Anthony&#60;br /&#62;
Thanks a lot.&#60;br /&#62;
Kind Regards Michal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Problem with linear source"</title>
			<link>http://www.k-wave.org/forum/topic/problem-with-linear-source#post-5106</link>
			<pubDate>Mon, 22 Jun 2015 13:34:34 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">5106@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Michal&#60;/p&#62;
&#60;p&#62;Actually it is because k-wave automatically adjusts the time step with the sound speed (due to the CFL condition: more info in the user manual). It arrives to you sensor at the same &#34;time index&#34; but not at the same time (see the slight modification of your code below).&#60;/p&#62;
&#60;p&#62;About the PML and the sensor. You can control wether the PML appears in the results with the boolean 'PMLInside'. If PMLInside is set to true, what you say is correct: you will have to put the source/sensor in the range 21 and 189. I suggest you to set PML to false so that your computational domain is only made up of the &#34;useful&#34; part (and k-wave automatically add the PML for the simulations) see p63 of user manual for more information.&#60;/p&#62;
&#60;p&#62;Best regards,&#60;/p&#62;
&#60;p&#62;Anthony&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;clear all;
close all
clc
% =========================================================================
% SIMULATION
% =========================================================================
%% 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
dx = 0.1e-3; % grid point spacing in the x direction [m]
dy = 0.1e-3; % grid point spacing in the y direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy);

%% define the properties of the propagation medium
medium.sound_speed =2000; % [m/s] or 1500 m/s
medium.density=1000; %[kg/m3]
kgrid.t_array = makeTime(kgrid, medium.sound_speed);

%% define source
source.p_mask=zeros(Nx,Ny);
source.p_mask(21,:)=1;
source.p(1,:)=toneBurst(10e6,0.5e6,3);

%% define a centered circular sensor
sensor.mask = zeros(Nx,Ny);
sensor.mask (Nx-21,:)=1;
sensor.record={&#38;#39;p&#38;#39;};

%% run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);%,&#38;#39;PlotScale&#38;#39;,&#38;#39;auto&#38;#39;);

% =========================================================================
% VISUALISATION
% =========================================================================
plot(kgrid.t_array,mean(sensor_data.p))&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>pakulam on "Problem with linear source"</title>
			<link>http://www.k-wave.org/forum/topic/problem-with-linear-source#post-5105</link>
			<pubDate>Mon, 22 Jun 2015 10:29:42 +0000</pubDate>
			<dc:creator>pakulam</dc:creator>
			<guid isPermaLink="false">5105@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear All&#60;br /&#62;
I am very beginner user of k-wave. I started with 2D simulations to 'feel' the software. I run first example and everything was ok. But then I tried to perform simulations with linear source placed on one side of the medium. The strange thing is that when  change the medium speed from 1500 m/s to 2000 m/s the pulse arrive at the same time. Do you have any idea what is wrong. the code I placed below.&#60;br /&#62;
The second question concerning the rules of appropriate positioning the source.&#60;br /&#62;
The default PML layer for 2D is 20 so it is obligatory to put the source and sensor out of this range?(e.g. if the size of my medium in x direction is 200. then I have to put the source/sensor in the range 21 and 189?&#60;br /&#62;
Michal&#60;/p&#62;
&#60;p&#62;The code&#60;br /&#62;
clear all;&#60;br /&#62;
close all&#60;br /&#62;
clc&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% SIMULATION&#60;br /&#62;
% =========================================================================&#60;br /&#62;
%% create the computational grid&#60;br /&#62;
Nx = 128;           % number of grid points in the x (row) direction&#60;br /&#62;
Ny = 128;           % number of grid points in the y (column) direction&#60;br /&#62;
dx = 0.1e-3;        % grid point spacing in the x direction [m]&#60;br /&#62;
dy = 0.1e-3;        % grid point spacing in the y direction [m]&#60;br /&#62;
kgrid = makeGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;%% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed =2000;  % [m/s] or 1500 m/s&#60;br /&#62;
medium.density=1000; %[kg/m3]&#60;/p&#62;
&#60;p&#62;%% define source&#60;br /&#62;
source.p_mask=zeros(Nx,Ny);&#60;br /&#62;
source.p_mask(21,:)=1;&#60;br /&#62;
source.p(1,:)=toneBurst(10e6,0.5e6,3);&#60;/p&#62;
&#60;p&#62;%% define a centered circular sensor&#60;br /&#62;
sensor.mask = zeros(Nx,Ny);&#60;br /&#62;
sensor.mask (Nx-21,:)=1;&#60;br /&#62;
sensor.record={'p'};&#60;/p&#62;
&#60;p&#62;%% run the simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);%,'PlotScale','auto');&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#60;br /&#62;
plot(mean(sensor_data.p))
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
