<?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: The size of kgrid.t_array seems error which is produced by the function makeTime</title>
		<link>http://www.k-wave.org/forum/topic/the-size-of-kgridt_array-seems-error-which-is-produced-by-the-function-maketime</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 02:31:16 +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/the-size-of-kgridt_array-seems-error-which-is-produced-by-the-function-maketime" rel="self" type="application/rss+xml" />

		<item>
			<title>sins on "The size of kgrid.t_array seems error which is produced by the function makeTime"</title>
			<link>http://www.k-wave.org/forum/topic/the-size-of-kgridt_array-seems-error-which-is-produced-by-the-function-maketime#post-8219</link>
			<pubDate>Wed, 16 Jun 2021 06:49:33 +0000</pubDate>
			<dc:creator>sins</dc:creator>
			<guid isPermaLink="false">8219@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you, Brad. I will try this function later.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "The size of kgrid.t_array seems error which is produced by the function makeTime"</title>
			<link>http://www.k-wave.org/forum/topic/the-size-of-kgridt_array-seems-error-which-is-produced-by-the-function-maketime#post-8187</link>
			<pubDate>Tue, 08 Jun 2021 16:43:49 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8187@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Remy,&#60;/p&#62;
&#60;p&#62;There is a check in &#60;code&#62;kWaveGrid&#60;/code&#62; for when &#60;code&#62;kgrid.dt&#60;/code&#62; is a recurring number and thus the number of time steps (calculated by &#60;code&#62;floor(t_end / dt) + 1&#60;/code&#62;) would be one number short. &#60;/p&#62;
&#60;p&#62;In your case, &#60;code&#62;t_end/dt&#60;/code&#62; works out to be 5.000000000000001e+02 (i.e., there is an overflow in the last digit) and the same piece of code catches this and incorrectly adds 1 to the length of the time series.&#60;/p&#62;
&#60;p&#62;You can work around this by instead using &#60;code&#62;kgrid.setTime(Nt, dt)&#60;/code&#62; to set the time array.&#60;/p&#62;
&#60;p&#62;I've raised an issue to look at this case for the possible fix in the future.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>sins on "The size of kgrid.t_array seems error which is produced by the function makeTime"</title>
			<link>http://www.k-wave.org/forum/topic/the-size-of-kgridt_array-seems-error-which-is-produced-by-the-function-maketime#post-8146</link>
			<pubDate>Sat, 08 May 2021 08:10:46 +0000</pubDate>
			<dc:creator>sins</dc:creator>
			<guid isPermaLink="false">8146@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
   When I use makeTime function to create a time series, the end of the time series seems out of range.&#60;br /&#62;
   I set t_end = 6e-5s, and dt = 1.2e-7s, the length of the time series should be 501 points. But I got the time series with a length of 502, and the kgrid.t_array ends up with 6.012e-5s. I don't know if this is related to &#34;makeTime&#34; function. My test code is listed below, thank you for your help.&#60;br /&#62;
Version of MATLAB: R2020a&#60;br /&#62;
Version of k-Wave: 1.3&#60;/p&#62;
&#60;p&#62;Best Regards,&#60;br /&#62;
Remy.&#60;/p&#62;
&#60;p&#62;%%---------------------------&#60;br /&#62;
clear all;&#60;br /&#62;
% Define medium&#60;br /&#62;
medium.sound_speed = 1500;  % [m/s]&#60;br /&#62;
medium.density = 1000;&#60;/p&#62;
&#60;p&#62;object_sim.Nx = 501;  % number of grid points in the x (row) direction&#60;br /&#62;
object_sim.Ny = 501;  % number of grid points in the y (column) direction&#60;br /&#62;
object_sim.x = 100.2e-3;              % total grid size [m]&#60;br /&#62;
object_sim.y = 100.2e-3;              % total grid size [m]&#60;/p&#62;
&#60;p&#62;dx = object_sim.x/object_sim.Nx;      % grid point spacing in the x direction [m]&#60;br /&#62;
dy = object_sim.y/object_sim.Ny;      % grid point spacing in the y direction [m]&#60;br /&#62;
kgrid = makeGrid(object_sim.Nx, dx, object_sim.Ny, dy);&#60;br /&#62;
% create time series&#60;br /&#62;
cfl = 0.9;       %  speed*dt/min(dx,dy)&#60;br /&#62;
t_end = 600e-7;  %  time(seconds)&#60;br /&#62;
[kgrid.t_array,dt] = makeTime(kgrid, medium.sound_speed, cfl, t_end);&#60;br /&#62;
time.dt = dt;         % sampling time in sec 1.2e-7, 8.3333MHz&#60;br /&#62;
time.length = length(kgrid.t_array);      % number of points in time
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
