<?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: Effective propagation velocity differs from medium.sound_speed</title>
		<link>http://www.k-wave.org/forum/topic/effective-propagation-velocity-differs-from-mediumsound_speed</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:21:04 +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/effective-propagation-velocity-differs-from-mediumsound_speed" rel="self" type="application/rss+xml" />

		<item>
			<title>bencox on "Effective propagation velocity differs from medium.sound_speed"</title>
			<link>http://www.k-wave.org/forum/topic/effective-propagation-velocity-differs-from-mediumsound_speed#post-6932</link>
			<pubDate>Wed, 26 Jun 2019 11:15:22 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6932@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Michael, &#60;/p&#62;
&#60;p&#62;Try the simulation in 1D and see if you get the same result. There is some effect of the bandlimited interpolant, but the effect of simulating in 2D will be greater, I suspect, as the cross-correlation will not work well, because the pulse shape of the propagating wave will be different from the source pulse.&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MichaelElfering on "Effective propagation velocity differs from medium.sound_speed"</title>
			<link>http://www.k-wave.org/forum/topic/effective-propagation-velocity-differs-from-mediumsound_speed#post-6924</link>
			<pubDate>Tue, 25 Jun 2019 15:01:39 +0000</pubDate>
			<dc:creator>MichaelElfering</dc:creator>
			<guid isPermaLink="false">6924@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Ben,&#60;br /&#62;
Thanks very much for your response.&#60;br /&#62;
Yes the result gets pretty much perfect after a distance of about 1m is reached – as seen in the bottom diagram of my example. Here, the time it takes the signal to go from one grid point to the next matches the theoretical value almost perfectly.&#60;br /&#62;
I stumbled across the band-limited interpolant as well, but what made me wonder is that the error increases as the grid gets finer. To my understanding the error due to band-limited interpolant should decrease if I chose a finer grid since the band gets wider. Doesn’t it?&#60;br /&#62;
Is there any way to reduce this behaviour? Finer Grid (larger Nx) and smaller CFL doesn’t seem to do the job…  Maybe I’m doing it wrong?! Or maybe there is another way like some kind of smoothed time varying source?!&#60;br /&#62;
Anyhow many thanks for your support and for the very powerful Toolbox you build.&#60;br /&#62;
Best wishes,&#60;br /&#62;
Michael
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "Effective propagation velocity differs from medium.sound_speed"</title>
			<link>http://www.k-wave.org/forum/topic/effective-propagation-velocity-differs-from-mediumsound_speed#post-6920</link>
			<pubDate>Tue, 25 Jun 2019 10:54:18 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6920@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Michael, &#60;/p&#62;
&#60;p&#62;Most of the effect comes from the fact that in 2D the measured pulses have a different shape from the source. It is clearer if a symmetrical pulse is used as the source, as the measured time series will no longer be symmetrical. &#60;/p&#62;
&#60;p&#62;However, there is also a slight time shift between the signal measured at the source point and the signal measured at adjacent points. This is due to the band-limited interpolant (see other posts on this if you're interested). If you measure the time difference from a point a few grid points away from the source to points further away then your problem shouldn't arise.&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MichaelElfering on "Effective propagation velocity differs from medium.sound_speed"</title>
			<link>http://www.k-wave.org/forum/topic/effective-propagation-velocity-differs-from-mediumsound_speed#post-6881</link>
			<pubDate>Wed, 12 Jun 2019 12:31:47 +0000</pubDate>
			<dc:creator>MichaelElfering</dc:creator>
			<guid isPermaLink="false">6881@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
I’m trying to determine the medium property (speed of sound) based on the measured Time-of-Flight. When I started simulating some cases in k-wave I noticed, that the results I get differ from the theory especially close to the source. I’m using a time varying source and dirichlet boundary conditions. The magnitude of the error seems to depend on the grid resolution (Nx) and is independent from the cfl-number. Can anyone tell me what might be the cause?&#60;br /&#62;
Thanks&#60;br /&#62;
Michael&#60;/p&#62;
&#60;p&#62;Here is a simple case that demonstrates the problem:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;clearvars;

% =========================================================================
% SIMULATION
% =========================================================================

% create the computational grid
Nx = 512;           % number of grid points in the x (row) direction
Ny = 64;           % number of grid points in the y (column) direction
dx = 15/Nx;    	% grid point spacing in the x direction [m]
dy = dx;            % grid point spacing in the y direction [m]
kgrid = kWaveGrid(Nx, dx, Ny, dy);

% define the properties of the propagation medium
medium.sound_speed = 1500;  % [m/s]
medium.alpha_coeff = 0.75;  % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
cfl = 0.1;
endtime = 0.013; % [s]

% create the time array
kgrid.makeTime(medium.sound_speed, cfl, endtime);

% define a row of source points
source.p_mask = zeros(Nx, Ny);
source.p_mask(end - Nx/4, Ny/2) = 1;

% define the properties of the tone burst used to drive the transducer
sampling_freq = 1/kgrid.dt;     % [Hz]
tone_burst_freq = 800;          % [Hz]
tone_burst_cycles = 6;
source_mag = 2;                 % [Pa]

% create the tone burst signals
source.p = source_mag * toneBurst(sampling_freq, tone_burst_freq, tone_burst_cycles);
padsz = length(kgrid.t_array)-length(source.p);
source.p = padarray(source.p, [0 padsz], 0, &#38;#39;post&#38;#39;);

% filter the source to remove high frequencies not supported by the grid
source.p = filterTimeSeries(kgrid, medium, source.p);

source.p_mode = &#38;#39;dirichlet&#38;#39;;

% define a single sensor point
sensor.mask = zeros(Nx, Ny);
sensor.mask(Nx/4:end - Nx/4, Ny/2) = 1;

% define the acoustic parameters to record
sensor.record = {&#38;#39;p&#38;#39;, &#38;#39;p_final&#38;#39;};

% run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);

%% calculate Time of Flight between two sensor points
[NS, ~] = size(sensor_data.p);
tof = zeros(1, NS);
x2 = source.p;   % source signal
for j=1:NS
        x1 = squeeze(sensor_data.p(j, :));    % receiver signal
        [y1, lags] = xcorr(x1,x2);
        [~,idx] = max(y1);
        tof(j) = lags(idx) * kgrid.dt;
end

dist = (kgrid.x(logical(source.p_mask))-kgrid.x(logical(sensor.mask)))&#38;#39;;

c = dist./tof;         % mean speed of sound between the source an the sensor
c(end) = nan;
tofn = tof/kgrid.dt;   % Normalized ToF
deltatn = -diff(tofn); % Number of Timesteps it takes the signal to get from one grid cell to the next

% theoretical values
c_theo = ones(1, length(c))* medium.sound_speed;
deltatn_theo = ones(1, length(deltatn))*(kgrid.dx / (medium.sound_speed * kgrid.dt));

% =========================================================================
%% VISUALISATION
% =========================================================================

% plot calulated speed of Sound
figure;
[~, scale, prefix] = scaleSI(max(dist(:)));
subplot(2, 1, 1);
plot(dist * scale, c, &#38;#39;k-&#38;#39;, &#38;#39;DisplayName&#38;#39;, &#38;#39;simulation&#38;#39;);
hold on;
plot(dist * scale, c_theo, &#38;#39;r-&#38;#39;, &#38;#39;DisplayName&#38;#39;, &#38;#39;theoretical&#38;#39;);
hold off;
xlabel([&#38;#39;distance [&#38;#39; prefix &#38;#39;m]&#38;#39;]);
ylabel(&#38;#39;speed of sound [m/s]&#38;#39;);
axis tight;
title(&#38;#39;effective SoS between source and sensor&#38;#39;);
legend(&#38;#39;simulation&#38;#39;,&#38;#39;theoretical&#38;#39;);

subplot(2, 1, 2);
plot(dist * scale, [deltatn 0], &#38;#39;k-&#38;#39;, &#38;#39;DisplayName&#38;#39;, &#38;#39;simulation&#38;#39;);
hold on;
plot(dist * scale, [deltatn_theo 0], &#38;#39;r-&#38;#39;, &#38;#39;DisplayName&#38;#39;, &#38;#39;theoretical&#38;#39;);
hold off;
xlabel([&#38;#39;distance [&#38;#39; prefix &#38;#39;m]&#38;#39;]);
ylabel(&#38;#39;number of time steps&#38;#39;);
axis tight;
title(&#38;#39;number of time steps for each grid step&#38;#39;);
legend(&#38;#39;simulation&#38;#39;,&#38;#39;theoretical&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
