Hi,

When I use makeTime function to create a time series, the end of the time series seems out of range.

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 "makeTime" function. My test code is listed below, thank you for your help.

Version of MATLAB: R2020a

Version of k-Wave: 1.3

Best Regards,

Remy.

%%---------------------------

clear all;

% Define medium

medium.sound_speed = 1500; % [m/s]

medium.density = 1000;

object_sim.Nx = 501; % number of grid points in the x (row) direction

object_sim.Ny = 501; % number of grid points in the y (column) direction

object_sim.x = 100.2e-3; % total grid size [m]

object_sim.y = 100.2e-3; % total grid size [m]

dx = object_sim.x/object_sim.Nx; % grid point spacing in the x direction [m]

dy = object_sim.y/object_sim.Ny; % grid point spacing in the y direction [m]

kgrid = makeGrid(object_sim.Nx, dx, object_sim.Ny, dy);

% create time series

cfl = 0.9; % speed*dt/min(dx,dy)

t_end = 600e-7; % time(seconds)

[kgrid.t_array,dt] = makeTime(kgrid, medium.sound_speed, cfl, t_end);

time.dt = dt; % sampling time in sec 1.2e-7, 8.3333MHz

time.length = length(kgrid.t_array); % number of points in time