<?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: how to simulate a plane wave with multiple frequency</title>
		<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:05:36 +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/how-to-simulate-a-plane-wave-with-multiple-frequency" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-6515</link>
			<pubDate>Fri, 13 Jul 2018 21:50:17 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6515@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;No estimate at this stage I'm afraid. It's on the development list, just not sure if it will make it into the next release.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jlc4kk on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-6504</link>
			<pubDate>Mon, 25 Jun 2018 17:57:13 +0000</pubDate>
			<dc:creator>jlc4kk</dc:creator>
			<guid isPermaLink="false">6504@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thank you, Brad. I am running the GPU code, kspaceFirstOrder3DG, from Matlab interface. Is there an estimate of when this functionality will be available?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-6483</link>
			<pubDate>Thu, 14 Jun 2018 22:36:36 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">6483@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;If you are using the MATLAB code, there is undocumented functionality where you can assign a non-integer source mask, where each value corresponds to a selection of grid points that belong to a particular transducer. You can then assign a time series for each transducer element (i.e., each unique positive integer in the source mask). &#60;/p&#62;
&#60;p&#62;As an example, open the &#34;Monopole Point Source In A Homogeneous Propagation Medium Example&#34; and replace the source definition with:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% define a source points
source.p_mask = zeros(Nx, Ny);
source.p_mask(3*Nx/4, Ny/2:Ny/2 + 10) = 1;
source.p_mask(Nx/4,   Ny/2:Ny/2 + 10) = 2;

% define a time varying sinusoidal source
source_freq1 = 0.25e6;   % [Hz]
source_freq2 = 0.5e6;   % [Hz]
source.p(1, :) = sin(2 * pi * source_freq1 * kgrid.t_array);
source.p(2, :) = sin(2 * pi * source_freq2 * kgrid.t_array);

% filter the source to remove high frequencies not supported by the grid
source.p(1, :) = filterTimeSeries(kgrid, medium, source.p(1, :));
source.p(2, :) = filterTimeSeries(kgrid, medium, source.p(2, :));&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Note, this functionality will be replaced with something more general in a future version (which will also work using the C++ code), so the syntax will almost certainly change.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jlc4kk on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-6469</link>
			<pubDate>Fri, 18 May 2018 02:35:48 +0000</pubDate>
			<dc:creator>jlc4kk</dc:creator>
			<guid isPermaLink="false">6469@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I have a follow up question related to this last post. &#60;/p&#62;
&#60;p&#62;With latest k-Wave version (1.2.1), I am simulating tissue/bone heating using a transducer comprised of four concentric rings each one driven slightly off phase starting at 1 MHz, 1.001 MHz, and so on. I discretized it so there are ~50,000 active elements divided approximately evenly across the four rings. I am using kspaceFirstOrder3D with absorbion + heterogenous properties (medium.sound_speed, medium.density, and medium.alpha_coeff). In accordance with the &#34;checkStability.m&#34;, I set the recommended time step and require about 23,000 steps total to get to steady state. &#60;/p&#62;
&#60;p&#62;I am running into memory constraints as my source.p is large [50,000 active elements x 23,000 num. of time steps]. This is due to copying the time series for each active element as in the example code above:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;source.p(p_mask_1D == 1, :) = repmat(source1, [sum(p_mask_1D == 1), 1]);
source.p(p_mask_1D == 2, :) = repmat(source2, [sum(p_mask_1D == 2), 1]);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;As I only have 4 unique time series (for my 4 rings), is there a way to reduce memory here? My hope is to fit onto a GPU.&#60;/p&#62;
&#60;p&#62;Thank you,&#60;br /&#62;
JLC
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-4535</link>
			<pubDate>Thu, 22 May 2014 14:55:33 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4535@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Arslan,&#60;/p&#62;
&#60;p&#62;Again, the list of time series must follow the source mask following MATLAB's linear matrix index ordering. However, as k-Wave is currently coded, it's not completely trivial to assign different time series to different blocks of the source mask. Here's an example of how you might do it using a source mask that is defined using different regions labelled with different numbers:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% define two different discs
disc1 = makeDisc(Nx, Ny, Nx/4, Ny/2, 5);
disc2 = makeDisc(Nx, Ny, 3*Nx/4, Ny/2, 4);

% define two time series for each disc
source1 = sin(2*pi*0.25e6*kgrid.t_array);
source2 = 2*sin(2*pi*1e6*kgrid.t_array);

% assign discs to source mask
source.p_mask = zeros(Nx, Ny);
source.p_mask(disc1 == 1) = 1;
source.p_mask(disc2 == 1) = 2;

% collapse the source mask to a 1D vector and remove the zeros
p_mask_1D = source.p_mask(:);
p_mask_1D(p_mask_1D == 0) = [];

% use the labelled 1D source mask to assign the correct time series
% to each source point
source.p = zeros(sum(sum(source.p_mask == 1)), kgrid.Nt);
source.p(p_mask_1D == 1, :) = repmat(source1, [sum(p_mask_1D == 1), 1]);
source.p(p_mask_1D == 2, :) = repmat(source2, [sum(p_mask_1D == 2), 1]);

% make the source mask binary
source.p_mask = source.p_mask ~= 0;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rarslana on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-4501</link>
			<pubDate>Mon, 05 May 2014 05:59:25 +0000</pubDate>
			<dc:creator>rarslana</dc:creator>
			<guid isPermaLink="false">4501@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad!&#60;/p&#62;
&#60;p&#62;Thank you very much for your response its quite helpful, here I have another inquiry what if I have to add this time varying source to source mask like disc, circle etc. as initial value. DO I create source mask as&#60;/p&#62;
&#60;p&#62;source.p_mask = zeros(Nx, Ny);&#60;br /&#62;
source.p_mask = makedisc( , , , ,);&#60;br /&#62;
source.p_mask = makedisc( , , , ,);&#60;/p&#62;
&#60;p&#62;source.p = zeros(sum(source.p_mask(:)), kgrid.Nt);&#60;br /&#62;
source.p(1, :) = source_mag*sin(2*pi*source_freq_1*kgrid.t_array);&#60;br /&#62;
source.p(2, :) = source_mag*sin(2*pi*source_freq_2*kgrid.t_array);&#60;/p&#62;
&#60;p&#62;Kindly advise. Your cooperation is greatly appreciated.&#60;/p&#62;
&#60;p&#62;Regards&#60;br /&#62;
Arslan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-4487</link>
			<pubDate>Thu, 24 Apr 2014 18:35:49 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">4487@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Arslan,&#60;/p&#62;
&#60;p&#62;To use different time series for each source point in &#60;code&#62;source.p_mask&#60;/code&#62;, you must define &#60;code&#62;source.p&#60;/code&#62; as a 2D matrix. Each row of the matrix corresponds to the time series for a different source point. The ordering of the source points follows MATLAB linear matrix indexing. In your case, you have two different source points with different frequencies, so the code would be something like:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;source.p = zeros(sum(source.p_mask(:)), kgrid.Nt);
source.p(1, :) = source_mag*sin(2*pi*source_freq_1*kgrid.t_array);
source.p(2, :) = source_mag*sin(2*pi*source_freq_2*kgrid.t_array);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;There is some information in Section 3.4 of the &#60;a href=&#34;http://www.k-wave.org/documentation.php&#34;&#62;k-Wave manual&#60;/a&#62; that might be helpful.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rarslana on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-4471</link>
			<pubDate>Fri, 18 Apr 2014 20:06:20 +0000</pubDate>
			<dc:creator>rarslana</dc:creator>
			<guid isPermaLink="false">4471@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I am trying to define two sources with different frequencies propagating in the same kgrid. In order to do this I have defined two source.p_mask as follow&#60;br /&#62;
source.p_mask = zeros(Nx, Ny);&#60;br /&#62;
source.p_mask(end - Nx*0.625, Ny*0.375) = 1;&#60;br /&#62;
source.p_mask(end - Nx*0.375, Ny*0.375) = 1;&#60;/p&#62;
&#60;p&#62;and in order to assign sources with different frequency to each of this source mask I did as follow;&#60;/p&#62;
&#60;p&#62;source.p(end - Nx*0.625, Ny*0.375) = source_mag*sin(2*pi*source_freq_1*kgrid.t_array);&#60;br /&#62;
source.p(end - Nx*0.375, Ny*0.375) = source_mag*sin(2*pi*source_freq_2*kgrid.t_array);&#60;/p&#62;
&#60;p&#62;Is  this the right way of defining two source because I keep on getting error&#60;br /&#62;
'Reference to non-existent field'p'.'. Kindly advise me the right way. Your help is highly appreciated.&#60;/p&#62;
&#60;p&#62;Thank you&#60;/p&#62;
&#60;p&#62;Arslan
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-205</link>
			<pubDate>Wed, 27 Jul 2011 00:46:32 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">205@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;/p&#62;
&#60;p&#62;When a wave propagates from one medium to another, if the second medium has a higher impedance, the reflected wave will be in phase with the incident wave. If the second medium has a lower impedance, the reflected wave will instead be 180 degrees out of phase (so a positive pressure wave will become a negative pressure wave and vice-versa). In both cases, the transmitted wave will be in phase with the incident wave.&#60;/p&#62;
&#60;p&#62;In your example, you have a region of higher impedance in the middle of your medium. In this case, the wave that is reflected back and forth will change signs each time it reaches the medium interfaces because the surrounding medium has a lower impedance. You can see more clearly what is happening if you switch the plot setting on.&#60;/p&#62;
&#60;p&#62;I hope that helps. You can find more information in a standard acoustics text, for example Kinsler &#38;amp; Frey (Page 152 in the 4th Edition).&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-204</link>
			<pubDate>Tue, 26 Jul 2011 22:45:08 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">204@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Dr. Cox,&#60;/p&#62;
&#60;p&#62;Sorry to bother you again, but I noticed a phenomenon in 1D simulation with heterogeneous medium, and I don't know if it's reasonable.&#60;/p&#62;
&#60;p&#62;Nx = 512;&#60;br /&#62;
dx = 0.1e-3;&#60;br /&#62;
kgrid = makeGrid(Nx, dx);&#60;/p&#62;
&#60;p&#62;medium.sound_speed = 1500*ones(Nx,1);&#60;br /&#62;
medium.sound_speed(200:300) = 3000;&#60;br /&#62;
medium.density = 1000*ones(Nx,1);&#60;br /&#62;
medium.density(200:300) = 2000;&#60;/p&#62;
&#60;p&#62;[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed);&#60;br /&#62;
kgrid.t_array = (0:4999)*dt;&#60;/p&#62;
&#60;p&#62;x_pos = 70;&#60;br /&#62;
width = 20;&#60;br /&#62;
height = 1;&#60;br /&#62;
in = 0:pi/(width/2):2*pi;&#60;br /&#62;
source.p0 = [zeros(x_pos,1); ((height/2)*sin(in-pi/2)+(height/2)).'; zeros(Nx - x_pos  - width - 1, 1)];&#60;/p&#62;
&#60;p&#62;sensor.mask = zeros(Nx, 1);&#60;br /&#62;
sensor.mask(150) = 1;&#60;br /&#62;
sensor.mask(400) = 1;&#60;/p&#62;
&#60;p&#62;sensor_data = kspaceFirstOrder1D(kgrid, medium, source, sensor, 'PlotSim', false, 'Smooth', false);&#60;/p&#62;
&#60;p&#62;The signal from the first sensor looks like:&#60;br /&#62;
&#60;img src=&#34;http://i.imgur.com/0XZGb.jpg&#34; /&#62;&#60;br /&#62;
The signal from the second sensor looks like:&#60;br /&#62;
&#60;img src=&#34;http://i.imgur.com/S3prr.jpg&#34; /&#62;&#60;/p&#62;
&#60;p&#62;I don't know why the reflect wave pressure recorded in the first sensor become negative, while the signals from the 2nd sensor are always positive. Is this reasonable?&#60;/p&#62;
&#60;p&#62;Thank you very much!&#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-201</link>
			<pubDate>Mon, 25 Jul 2011 16:08:02 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">201@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Dr. Cox,&#60;/p&#62;
&#60;p&#62;Just ignore my last post. The amplitude does not decay. It's my mistake. Sorry about that.&#60;/p&#62;
&#60;p&#62;Chao
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-200</link>
			<pubDate>Fri, 22 Jul 2011 19:59:26 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">200@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;br /&#62;
It shouldn't do, if the absorption's turned off. Can you post your code?&#60;br /&#62;
Thanks,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-199</link>
			<pubDate>Fri, 22 Jul 2011 17:23:22 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">199@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Dr. Cox,&#60;/p&#62;
&#60;p&#62;Thank you for your suggestion. I think simulating plane wave in 1D is a good idea, but I found that the signal will decay in 1D simulation (no absorption), as shown below&#60;/p&#62;
&#60;p&#62;&#60;img src=&#34;http://i.imgur.com/CAH1V.jpg&#34; /&#62;&#60;/p&#62;
&#60;p&#62;I don't why the amplitude will decay in 1D if it's plane wave.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-198</link>
			<pubDate>Fri, 22 Jul 2011 11:45:47 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">198@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;br /&#62;
At the moment that is the way to do it. If the whole problem is planar then you could do it in 1D, which would be much lighter on the memory.&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "how to simulate a plane wave with multiple frequency"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-simulate-a-plane-wave-with-multiple-frequency#post-197</link>
			<pubDate>Thu, 21 Jul 2011 18:26:29 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">197@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I want simulate a plane wave, is there any other ways to do this besides using a plane source (multiple point sources on a very large plane)?&#60;/p&#62;
&#60;p&#62;Thank you very much!&#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
