<?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: &#34;Simple&#34; 3D simulation: received signal question</title>
		<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:47:51 +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/simple-3d-simulation-received-signal-question" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4759</link>
			<pubDate>Wed, 08 Oct 2014 21:48:15 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4759@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Margot,&#60;/p&#62;
&#60;p&#62;I see exactly what you mean, but I'm afraid I'm no closer to an explanation! Would you be happy to share (or email me) your code?&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mgt_p on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4758</link>
			<pubDate>Mon, 06 Oct 2014 09:07:03 +0000</pubDate>
			<dc:creator>mgt_p</dc:creator>
			<guid isPermaLink="false">4758@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;My transducer.focus_distance is .04 + dx (so .04025m). I have not set any transducer.elevation_focus_distance (it makes it Inf, right?), and no steering. &#60;/p&#62;
&#60;p&#62;I plotted the raw sensor_data with the same scheme as before (I cut the signal in two, and normalize each half independantly so that the input signal and the scatterer echo both appear with an amplitude of 1). Here it is:&#60;br /&#62;
&#60;a href=&#34;https://www.dropbox.com/s/cydrfgx5b87wwye/not_preprocessed_sensor_data.PNG?dl=0&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/cydrfgx5b87wwye/not_preprocessed_sensor_data.PNG?dl=0&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;https://www.dropbox.com/s/u0a71s4tn9rmks6/raw_sensor_data.fig?dl=0&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/u0a71s4tn9rmks6/raw_sensor_data.fig?dl=0&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;It shows quite clearly that the input signal has the drift already... &#60;/p&#62;
&#60;p&#62;Regards,&#60;/p&#62;
&#60;p&#62;Margot
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4754</link>
			<pubDate>Fri, 03 Oct 2014 16:35:30 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4754@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Margot,&#60;/p&#62;
&#60;p&#62;Could you tell us a bit more about the exact simulation setup? What are your settings for &#60;code&#62;transducer.focus_distance&#60;/code&#62;, &#60;code&#62;transducer.elevation_focus_distance&#60;/code&#62;, and &#60;code&#62;transducer.steering_angle&#60;/code&#62;? Does the raw &#60;code&#62;sensor_data&#60;/code&#62; look ok before processing? &#60;/p&#62;
&#60;p&#62;You can include images in your posts as explained &#60;a href=&#34;http://www.k-wave.org/forum/topic/using-images-in-posts&#34;&#62;here&#60;/a&#62;, but you need to host them somewhere else I'm afraid.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mgt_p on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4746</link>
			<pubDate>Fri, 26 Sep 2014 16:46:36 +0000</pubDate>
			<dc:creator>mgt_p</dc:creator>
			<guid isPermaLink="false">4746@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;New simulation, new problem.&#60;/p&#62;
&#60;p&#62;I am now using an array that is more realistic than the previous one, with 64 elements and plausible size, but the rest is more or less the same.&#60;/p&#62;
&#60;p&#62;I am looking at sensor_data, just after the simulation, since I want to investigate receive beamforming.&#60;/p&#62;
&#60;p&#62;I can observe a drift (although not very linear) along my channels, as in my first echo appears later in sensor_data(64,:) than in sensor_data(1,:) when they have exactly the same spatial/physical phenomenon origin.&#60;/p&#62;
&#60;p&#62;You can have a look at plots of side-by-side channels here:&#60;br /&#62;
&#60;a href=&#34;https://www.dropbox.com/s/827cd4yk7fikd9r/side_by_side_sensor_data.PNG?dl=0&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/827cd4yk7fikd9r/side_by_side_sensor_data.PNG?dl=0&#60;/a&#62;&#60;br /&#62;
(all amplitudes should be disregarded, I do a lot of normalizations here and there to ease the visualization)&#60;br /&#62;
And if I zoom on the interface (which is the layer with higher sound speed), here is what I see:&#60;br /&#62;
&#60;a href=&#34;https://www.dropbox.com/s/kyh610hpqh7j64x/interface_drift.PNG?dl=0&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/kyh610hpqh7j64x/interface_drift.PNG?dl=0&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;However, appart from the normalization, I do get rid of the input signal using the Tukey windowing procedure used in the k-wave examples for medical ultrasound, and crop them to spatially relevant zones (from 0m to the actual end of my phantom).&#60;/p&#62;
&#60;p&#62;I can't figure out an explanation for this drift, my hypotheses being:&#60;br /&#62;
      - the sensors do not start &#34;recording&#34; at the same time&#60;br /&#62;
      - something happens in transmit beamforming (but I haven't looked into how it's done in k-wave at all).&#60;/p&#62;
&#60;p&#62;Do you have any hint as to what might be happening here? Or a direction in which I should look? I absolutely need to get rid of that drift (and without interpolation if possible)...&#60;/p&#62;
&#60;p&#62;Thank you very much,&#60;/p&#62;
&#60;p&#62;Margot&#60;/p&#62;
&#60;p&#62;PS: Is there a way to include the images in the posts in the forum?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mgt_p on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4686</link>
			<pubDate>Wed, 20 Aug 2014 07:52:14 +0000</pubDate>
			<dc:creator>mgt_p</dc:creator>
			<guid isPermaLink="false">4686@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad,&#60;/p&#62;
&#60;p&#62;Thanks for the additional information.&#60;br /&#62;
Yes, I had tried the C++ code when I was running bigger simulations, but it seemed kind of less reliable to work with non-beamformed data (cf my other post in the forum), so this time I decided I could afford the time :D But I will, eventually, go back to it I think.&#60;/p&#62;
&#60;p&#62;Regards,&#60;/p&#62;
&#60;p&#62;Margot
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4684</link>
			<pubDate>Tue, 19 Aug 2014 17:59:24 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4684@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Margot,&#60;/p&#62;
&#60;p&#62;This factorisation is fine. However, the small prime factors should be for the &#60;em&#62;total&#60;/em&#62; grid size, including the PML if &#60;code&#62;PMLInside&#60;/code&#62; is set to &#60;code&#62;false&#60;/code&#62;. Regarding the compute times, have you tried using the C++ code? It is relatively simple to use, you just need to download the binary and replace your calls to &#60;code&#62;kspaceFirstOrder3D&#60;/code&#62; with &#60;code&#62;kspaceFirstOrder3DC&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mgt_p on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4683</link>
			<pubDate>Tue, 19 Aug 2014 16:05:34 +0000</pubDate>
			<dc:creator>mgt_p</dc:creator>
			<guid isPermaLink="false">4683@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Brad,&#60;/p&#62;
&#60;p&#62;Thank you for your answer, as a matter of fact, I was also on holidays, so the timing did not matter for me!&#60;/p&#62;
&#60;p&#62;About the values of Nx, Ny and Nz, I have some reality constraints that I can't play too much with. Nevertheless, I tried to have better prime factors (2     2     2     2     2     7 for example), but I still end up with over 1hr of simulation time. I wonder then if the PML should be added for the prime factor effect to appear? Or is this decomposition not small enough?&#60;/p&#62;
&#60;p&#62;Thank you,&#60;/p&#62;
&#60;p&#62;Margot
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4680</link>
			<pubDate>Mon, 18 Aug 2014 18:17:46 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4680@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Margot,&#60;/p&#62;
&#60;p&#62;Apologies for taking so long to reply - it has been summer holidays here. &#60;/p&#62;
&#60;p&#62;The issue is related to high frequencies in your tone burst not being supported by the grid. You could resolve this by lowering the source frequency, decreasing the grid spacing, or filtering out the high frequencies from your input signal. &#60;/p&#62;
&#60;p&#62;For example, to do the latter you could add the following code after scaling:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% add some zeros to the start and end of the signal to give the
% filter room to work
input_signal = [zeros(size(input_signal)), input_signal, zeros(size(input_signal))];

% plot the amplitude spectrum before filtering
spect(input_signal, 1/kgrid.dt, &#38;#39;Plot&#38;#39;, [true, false]);

% remove high frequency components
med.sound_speed = 1500;
input_signal = filterTimeSeries(kgrid, med, input_signal, &#38;#39;ZeroPhase&#38;#39;, true);

% plot the amplitude spectrum after filtering
spect(input_signal, 1/kgrid.dt, &#38;#39;Plot&#38;#39;, [true, false]);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Adding this gave me nice clean looking reflections when plotting &#60;code&#62;sensor_data(5, :)&#60;/code&#62; after running your code snippet. &#60;/p&#62;
&#60;p&#62;I'd advise using &#60;code&#62;filterTimeSeries&#60;/code&#62; for all time varying input signals to be on the safe side. Notice I added some zeros before and after the signal to give it room to work (removing the high frequencies increases the width of the signal). I have also forced it to be zero phase so the features are not shifted as they would be if the filter was causal.&#60;/p&#62;
&#60;p&#62;For your simulation, I'd also suggest setting the values of Nx, Ny, and Nz explicitly so that they have small prime factors (you can check this using &#60;code&#62;checkFactors&#60;/code&#62; or &#60;code&#62;factor&#60;/code&#62;). This will make the simulations much faster.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mgt_p on "&#34;Simple&#34; 3D simulation: received signal question"</title>
			<link>http://www.k-wave.org/forum/topic/simple-3d-simulation-received-signal-question#post-4657</link>
			<pubDate>Wed, 23 Jul 2014 12:59:27 +0000</pubDate>
			<dc:creator>mgt_p</dc:creator>
			<guid isPermaLink="false">4657@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Mr Treeby,&#60;/p&#62;
&#60;p&#62;I am trying to simulate a &#34;simple&#34; set up, and I don't really understand the signals I receive.&#60;/p&#62;
&#60;p&#62;My phantom is homogenous in density but for a 2x2x2 pixels highly reflective scatterer in the middle (high density). In terms of speed of sound, it is homogenous, with a bulk at 1540m/s and a layer, placed before the scatterer, at higher speed of sound. The scatterer gets an extra reflective punch from having also a higher speed of sound. There is no attenuation set.&#60;/p&#62;
&#60;p&#62;I have a linear transducer, with only 10 elements, focused on my scatterer in azimuth, and not focused in elevation.&#60;/p&#62;
&#60;p&#62;My first question is regarding the signal I get when I do not inforce the layer.&#60;br /&#62;
I get this:&#60;br /&#62;
&#60;a href=&#34;https://www.dropbox.com/s/cwymc0crk3tn9cc/Signal_no_layer_after_Tukey_before_TGC.PNG&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/cwymc0crk3tn9cc/Signal_no_layer_after_Tukey_before_TGC.PNG&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;This, as the name says, is without any other post-processing step than the Tukey windowing to remove the trace of the input signal, but cropped to a the depth of my phantom.&#60;br /&#62;
I do not understand the first, very big, echo, as my scatterer shows up where it is expected, at 2cm*. Do you know where this comes from?&#60;/p&#62;
&#60;p&#62;* about the scatterer position: I actually found out that if I wanted it to be at the expected depth, I  had to build up the r vector not with t0 at half the input signal, but at a quarter of it. Any idea why? I had the feeling that the half-signal correction was more like a compromise than a definite rule.&#60;/p&#62;
&#60;p&#62;Then, when I put up the layer, I see echos within it that I'm not expecting.&#60;br /&#62;
&#60;a href=&#34;https://www.dropbox.com/s/mb8o57iayypaaty/Signal_layer_after_Tukey_before_TGC.PNG&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/mb8o57iayypaaty/Signal_layer_after_Tukey_before_TGC.PNG&#60;/a&#62;&#60;br /&#62;
The fact that my scatterer is drowned in the tail is not so much of a problem  if I can explain where this &#34;tail&#34; comes from. But the presence of some signal between the two interfaces of the layer is strange to me. &#60;/p&#62;
&#60;p&#62;My hypothesis at the moment is that the grid spacing is too coarse. Do you have a better idea?&#60;/p&#62;
&#60;p&#62;Thank you very much,&#60;/p&#62;
&#60;p&#62;Margot&#60;/p&#62;
&#60;p&#62;Code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;% define heterogenous medium

    % phantom size
    X = 0.04; %[m]
    Y = 0.02; %[m]
    Z = 0.02; %[m]

    % SOS bulk
    c = 1540; % [m/s]
    delta_c = 18; % [m/s]
    % density bulk
    rho = 1000; % [kg/m^3]
    % highly reflective scatterer properties
    scatterer.c = 1590;
    scatterer.rho = 2000; % [kg/m^3]

    % grid spacing
    dx = c/(3*2.85e6); % [m]
    dy = dx; % better for stability
    dz = dx; % better for stability

    % define the transducer
    % physical properties
    transducer.number_elements = 10;
    transducer.element_width = round(9.905e-4/dx);
    transducer.element_length = transducer.element_width;
    transducer.element_spacing = 0;
    transducer.radius = Inf;

    % effective grid size
    Nx = round(X/dx);
    Nz = round(Z/dz);

    n_scan_lines = 1;
    Ny_tot = round(Y/dy);
    Ny = Ny_tot - (n_scan_lines-1)*transducer.element_width;

    % layer depth
    L_top = 0.01; %[m]
    LTH = 0.005; %[m] layer thickness

    % highly reflective scatterer position
    scatterer.x = X/2; %[m]
    scatterer.y = Y/2; %[m]
    scatterer.z = Z/2; %[m]

    % PML size for border conditions
    PML_X = 30;
    PML_Y = 15;
    PML_Z = 15;

    % make grid
        % space
        kgrid = makeGrid(Nx,dx,Ny,dy,Nz,dz);
        % time
        t_end = (Nx*dx)*2.2/c;
        [kgrid.t_array,dt] = makeTime(kgrid, c, [], t_end);

    % medium physical properties
    SOS_map = repmat(c,[Nx,Ny_tot,Nz]);
    rho_map = repmat(rho,[Nx,Ny_tot,Nz]);
    % layer mask
    layer_mask = zeros(size(SOS_map));
    layer_mask(round(L_top/dx):round(L_top/dx)+round(LTH/dx),:,:) = 1;
    % neutral background map
    SOS_map(layer_mask == 1) = SOS_map(layer_mask == 1)+ delta_c;
    % highly reflective scatterer
    SOS_map(round(scatterer.x/dx):round(scatterer.x/dx)+1,...
            round(scatterer.y/dy):round(scatterer.y/dy)+1,...
            round(scatterer.z/dz):round(scatterer.z/dz)+1) = scatterer.c;
    rho_map(round(scatterer.x/dx):round(scatterer.x/dx)+1,...
            round(scatterer.y/dy):round(scatterer.y/dy)+1,...
            round(scatterer.z/dz):round(scatterer.z/dz)+1) = scatterer.rho;

% Transducer geometry
    % position and size
    element_size = [transducer.element_width transducer.element_length]*dx;
    transducer_aperture = element_size(1)*transducer.number_elements + (transducer.number_elements-1)*transducer.element_spacing*dx;

    transducer_width = transducer.number_elements*transducer.element_width ...
        + (transducer.number_elements - 1)*transducer.element_spacing;
    transducer.position = round([1, Ny/2 - transducer_width/2, Nz/2 - transducer.element_length/2]);

    % beamforming properties
    transducer.sound_speed = c;
    transducer.focus_distance = X/2 + dx; % in the middle of the phantom
    transducer.steering_angle = 0;
    transducer.active_elements = ones(transducer.number_elements,1);
    transducer.transmit_apodization = &#38;#39;Hanning&#38;#39;;
    transducer.receive_apodization = &#38;#39;Hanning&#38;#39;;

    % input signal
        % define properties of the input signal
        source_strength = 1e6;    	% [Pa]
        tone_burst_freq = 2.85e6; 	% [Hz]
        tone_burst_cycles = 4;

        % create the input signal using toneBurst
        input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);

        % scale the source magnitude by the source_strength divided by the
        % impedance (the source is assigned to the particle velocity)
        input_signal = (source_strength./(c*rho)).*input_signal;

        % assign
        transducer.input_signal = input_signal;

    % create
    transducer = makeTransducer(kgrid,transducer);

% Simulation scan
scan_line = zeros(n_scan_lines,kgrid.Nt);
medium_position = 1;
for l = 1:n_scan_lines

    medium.sound_speed = SOS_map(:,medium_position:medium_position + Ny - 1 ,:);
    medium.density = rho_map(:,medium_position:medium_position + Ny - 1,:);

input_args = {...
            &#38;#39;PMLInside&#38;#39;, false, &#38;#39;PlotSim&#38;#39;, false, &#38;#39;PMLSize&#38;#39;, [PML_X, PML_Y, PML_Z], ...
            &#38;#39;DataCast&#38;#39;, &#38;#39;single&#38;#39;};

sensor_data = kspaceFirstOrder3D(kgrid,medium,transducer,transducer,input_args{:});
        [rf,ch_data] = transducer.scan_line(sensor_data);&#60;/code&#62;&#60;/pre&#62;</description>
		</item>

	</channel>
</rss>
