<?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: compute green&#039;s function</title>
		<link>http://www.k-wave.org/forum/topic/compute-greens-function</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:17:31 +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/compute-greens-function" rel="self" type="application/rss+xml" />

		<item>
			<title>bencox on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-6673</link>
			<pubDate>Wed, 05 Dec 2018 01:10:22 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6673@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Mohsen,&#60;/p&#62;
&#60;p&#62;Try turning the 'smooth' option off, by adding the optional argument &#60;code&#62;...,&#38;#39;Smooth&#38;#39;, false)&#60;/code&#62; in kspaceFirstOrder3D.&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-6672</link>
			<pubDate>Tue, 04 Dec 2018 13:34:56 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">6672@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi maryam.parto, &#60;/p&#62;
&#60;p&#62;Good question. I put that 4 in there to make the output equal 1, but now I look as it again it's not clear to me what that factor should be in the general case. I will investigate further....&#60;/p&#62;
&#60;p&#62;Thanks for the question!&#60;/p&#62;
&#60;p&#62;Best wishes,&#60;br /&#62;
Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mohsen on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-6661</link>
			<pubDate>Mon, 26 Nov 2018 01:51:04 +0000</pubDate>
			<dc:creator>mohsen</dc:creator>
			<guid isPermaLink="false">6661@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello People&#60;/p&#62;
&#60;p&#62;to find a matrix model to build a linear system is in my interest.&#60;/p&#62;
&#60;p&#62;as you said I put the source.p0 = 1 which means an impulse in my pixel. for each pixel I put it and the solution which is impulse response will be assigned in the columns of the interested matrix. but when I multiply this matrix in the initial value pressure field although the behaviour of the plot is the same as the solution of k wave the magnitude is different.&#60;br /&#62;
I will be thankful if somebody guides me&#60;/p&#62;
&#60;p&#62;the Best&#60;br /&#62;
Mohsen
&#60;/p&#62;</description>
		</item>
		<item>
			<title>maryam.parto on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-6573</link>
			<pubDate>Tue, 28 Aug 2018 10:17:16 +0000</pubDate>
			<dc:creator>maryam.parto</dc:creator>
			<guid isPermaLink="false">6573@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hello dear bencox,&#60;br /&#62;
My question is how do you scale the delta function for setting the initial pressure gradient? Actually, I can't understand the line &#34;source.dp0dt=delta./4dt&#34;. why did you divide it by 4? Generally, I would be grateful if you explain me how can I obtain the initial pressure gradient from a known initial pressure.&#60;br /&#62;
thanks a lot
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-342</link>
			<pubDate>Thu, 01 Mar 2012 00:56:37 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">342@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;/p&#62;
&#60;p&#62;Yes, very similar. Both will remove the high frequency components.&#60;/p&#62;
&#60;p&#62;Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-341</link>
			<pubDate>Thu, 01 Mar 2012 00:45:08 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">341@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, Dr. Cox,&#60;/p&#62;
&#60;p&#62;I have read your paper, and it's clearer to me now about the oscillation.&#60;/p&#62;
&#60;p&#62;In your paper, the oscillations in the recorded time series were reduced by smoothing the initial pressure distribution (Kronecker delta function) by using windows in spatial frequency domain (k-space), and I am wondering if this is equivalent to smooth the recorded time series by use of windows in temporal frequency domain.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-330</link>
			<pubDate>Fri, 24 Feb 2012 10:21:37 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">330@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;/p&#62;
&#60;p&#62;The oscillations come from the fact that what you are seeing is the propagation of the underlying bandlimited function, which (as the code in my previous post showed) is an oscillating function. So you are getting what you should expect to get. It is not that it is inaccurate, it is that what you thought was originally a delta function wasn't (as explained above) it was just that at t=0 you were sampling it mostly at zeros so it looked like a delta function. At other times you might be sampling at different points on the wave form and so you will now see oscillations. Have a look at &#60;a href=&#34;http://www.k-wave.org/papers/2011-Treeby-JASA.pdf&#34;&#62;this paper&#60;/a&#62; for more explanation.&#60;/p&#62;
&#60;p&#62;As I said before, you can only get a bandlimited version of the Green's function when calculating it discretely. The only way to get closer to a Dirac delta function is to user a finer mesh. If you define your discrete delta properly (so its height grows as the pixel size reduces) then in the limit of an infinitesimally small pixel size it will converge towards the Dirac delta function, and the output will converge towards the Green's function (without any bandlimiting).&#60;/p&#62;
&#60;p&#62;Hope that's clearer,&#60;/p&#62;
&#60;p&#62;Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-329</link>
			<pubDate>Thu, 23 Feb 2012 22:06:53 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">329@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Dr. Cox,&#60;/p&#62;
&#60;p&#62;Thank you very much for the detailed explanation. It's very helpful.&#60;/p&#62;
&#60;p&#62;I have one more question, that is when I set source.p0 to be 1 at a single grid point to calculate the impulse response ('sensor_data' in the code), or the time derivative of the Green's function, whatever you call it, it has a lot of oscillations. Of course, this can be avoid by smoothing the source.p0, but it will compromise the accuracy of the computed impulse response, because the source is not Kronecker δ after smoothing.&#60;/p&#62;
&#60;p&#62;Any ideas to how to avoid the oscillation and also maintain the impulse response accuracy at the same time?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-328</link>
			<pubDate>Thu, 23 Feb 2012 12:45:54 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">328@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;/p&#62;
&#60;p&#62;On point (1): what you think is a perfect delta function, because you only see a single 1 and many zeros, can be thought of as a discrete representation of a continuous signal, i.e. you are only looking at a sampled version of the underlying continuous signal. The underlying continuous signal depends on the basis functions you choose (i.e. how you choose to interpolate between the samples) and for a Fourier basis, the underlying function that fits these samples is a bandlimited, oscillatory function. Run this code and you will see what I mean.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
% create the computational grid&#60;br /&#62;
Nx = 64;            % number of grid points in the x (row) direction&#60;br /&#62;
dx = 1;        % grid point spacing in the x direction [m]&#60;br /&#62;
x = (-Nx/2:Nx/2-1)*dx;&#60;/p&#62;
&#60;p&#62;% define a single source pixel (numerical delta function)&#60;br /&#62;
delta = zeros(Nx,1);&#60;br /&#62;
delta(Nx/2+1) = 1;&#60;/p&#62;
&#60;p&#62;% calculate underlying bandlimited delta function using a much finer mesh&#60;br /&#62;
dx_fine = 0.001;&#60;br /&#62;
x_fine = min(x):dx_fine:max(x);&#60;br /&#62;
underlying_func = (1/Nx)*cot(x_fine*pi/(dx*Nx)).*sin(x_fine*pi/dx);&#60;br /&#62;
underlying_func(x_fine==0) = 1;&#60;/p&#62;
&#60;p&#62;% plots&#60;br /&#62;
figure&#60;br /&#62;
subplot(3,1,1)&#60;br /&#62;
    stem(x,delta,'o')&#60;br /&#62;
    axis([min(x) max(x) -0.22 1])&#60;br /&#62;
    title('''discrete'' delta function')&#60;br /&#62;
subplot(3,1,2)&#60;br /&#62;
    plot(x_fine,underlying_func,'k')&#60;br /&#62;
    axis([min(x) max(x) -0.22 1])&#60;br /&#62;
    title('underlying bandlimited function')&#60;br /&#62;
subplot(3,1,3)&#60;br /&#62;
    stem(x,delta,'o')&#60;br /&#62;
    hold on&#60;br /&#62;
    plot(x_fine,underlying_func,'k')&#60;br /&#62;
    axis([min(x) max(x) -0.22 1])&#60;br /&#62;
    title('''discrete'' delta is sampled version of bandlimited function')&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;(2) Yes. You could think of this as a linear system (as long as you stick to the linear wave equation and not the nonlinear version). You can imagine a matrix equation with a vector of p(x,t) stacked up on the left, a matrix made up by discretising the wave operator, and an initial condition (or a source, depending on how you have written the operator matrix) on the right. You haven't avoided solving the wave equation: this just is a method for solving the wave equation (and probably not a very efficient one). You need to choose some way of discretizing the wave operator to form the system matrix, and that might be using finite differences, finite elements, spectral approaches, or whatever you like!&#60;/p&#62;
&#60;p&#62;(3) These are equivalent in the sense that p_0 = \Gamma H is true for photoacoustics (when the optical pulse is short enough), and dp/dt = 0 when u = 0 (which can be seen by combining the mass conservation equation and pressure-density relation). &#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-327</link>
			<pubDate>Thu, 23 Feb 2012 07:02:39 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">327@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Dr. Cox,&#60;/p&#62;
&#60;p&#62;Thanks for your reply, and I have some additional questions:&#60;/p&#62;
&#60;p&#62;1. I don't understand why Kronecker delta is a band-limited version of the Dirac delta function. In my opinion, the spectrum of Kronecker delta is still infinitely wide. For example, if you plot the amplitude spectrum of the Kronecker delta using MATALB commands 'plot(abs(fft([1, zeros(1,N)])))', the amplitude of all frequency components is 1.&#60;/p&#62;
&#60;p&#62;2. I agree that setting source.p0 is 1 at a single grid point will give the time derivative of the Green's function. This leads to another relevant question: Is solving the linear wave equation (no matter the 2nd order equation, or the 3 coupled 1st order equations) is equivalent to compute the output of a linear system where source is the input?&#60;/p&#62;
&#60;p&#62;If so, for the photoacoustic wave equation:&#60;/p&#62;
&#60;p&#62;&#60;img src=&#34;http://i.imgur.com/C3jyF.jpg&#34; /&#62;&#60;/p&#62;
&#60;p&#62;we can treat the source H as the input, p as the output, and other parts of the equation (including the time derivative on the right side) as the linear system operator. In this case, because H=A(r)δ(t) is used as the source term for photoacoustic wave equation, just setting source.p0 is 1 at a single grid point (A(r) becomes Kronecker δ) is equivalent to setting the input as an impulse (if Kronecker δ is indeed a good approximation of Dirac δ). Then using k-Wave to solve the equation will give us the impulse response of the linear system, which can be used to compute the output (p) just like any other linear systems if somehow we don't want to solve the wave equation to compute p.&#60;/p&#62;
&#60;p&#62;3. I noticed that when solving the wave equation, 2nd order equation or 1st order equations, there are 2 kinds of initial conditions:&#60;/p&#62;
&#60;p&#62;&#60;img src=&#34;http://i.imgur.com/ZVpQ9.jpg&#34; /&#62;&#60;/p&#62;
&#60;p&#62;&#60;img src=&#34;http://i.imgur.com/fvZT5.jpg&#34; /&#62;&#60;/p&#62;
&#60;p&#62;Could you tell me what's the relation between these 2 initial conditions? Are they equivalent?&#60;/p&#62;
&#60;p&#62;Thanks again for your help!&#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bencox on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-325</link>
			<pubDate>Wed, 22 Feb 2012 14:02:37 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">325@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Chao,&#60;/p&#62;
&#60;p&#62;The frequency spectrum of a Dirac delta function is infinitely wide, whereas any numerical model will have some upper limit on the frequencies it can deal with which is set by the spacing of the grid, so the best you can hope for is a band-limited version of the Green's function. (When you input a Kronecker delta you are effectively using a band-limited version of the Dirac delta function). In practice, you just need to ensure the bandwidth is wide enough for your application.&#60;/p&#62;
&#60;p&#62;Setting the initial condition that &#60;code&#62;source.p0&#60;/code&#62; is 1 at a single pixel will not give you the Green's function but the time derivative of the Green's function, as that initial condition is equivalent to using the time derivative of the delta function as a source term. The Green's function is defined as the solution that arises from using a delta function as the source term which you can get by setting the initial pressure gradient. Something like this example below (which easily extends to 2D and 3D) gives the gist of it.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
% create the computational grid&#60;br /&#62;
Nx = 512;            % number of grid points in the x (row) direction&#60;br /&#62;
dx = 0.1e-3;        % grid point spacing in the x direction [m]&#60;br /&#62;
kgrid = makeGrid(Nx, dx);&#60;br /&#62;
k = kgrid.k;&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = 1500;  % [m/s]&#60;/p&#62;
&#60;p&#62;% define a time array&#60;br /&#62;
[kgrid.t_array dt] = makeTime(kgrid,medium.sound_speed);&#60;br /&#62;
kgrid.t_array = (0:length(kgrid.t_array)/2)*dt;&#60;/p&#62;
&#60;p&#62;% define a single source pixel&#60;br /&#62;
delta = zeros(Nx,1);&#60;br /&#62;
delta(Nx/2+1) = 1;&#60;/p&#62;
&#60;p&#62;%scale the delta function to have unit area (in time) and assign to the&#60;br /&#62;
%initial pressure gradient&#60;br /&#62;
source.dp0dt = delta./(4*dt);&#60;/p&#62;
&#60;p&#62;% define a single sensor point&#60;br /&#62;
sensor.mask = zeros(Nx,1);&#60;br /&#62;
sensor.mask(Nx/4) = 1;&#60;/p&#62;
&#60;p&#62;% run the simulation&#60;br /&#62;
output = kspaceSecondOrder(kgrid, medium, source, sensor,'PlotScale',[0 1.5]);&#60;/p&#62;
&#60;p&#62;%plot the output, which is the bandlimited Green's function.&#60;br /&#62;
figure&#60;br /&#62;
plot(kgrid.t_array, output)&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;On your other point, k-Wave does the spatial calculations using Fourier basis functions (it is a type of Fourier pseudospectral method), but there won't be any additional higher frequency information between the pixels in the grid so you could just interpolate linearly and it will be ok.&#60;/p&#62;
&#60;p&#62;Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "compute green&#039;s function"</title>
			<link>http://www.k-wave.org/forum/topic/compute-greens-function#post-323</link>
			<pubDate>Wed, 22 Feb 2012 07:56:48 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">323@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I want to compute the wave filed from a point source, which is called Green's function or point spread function, by using k-Wave. Theoretically, the point source is described by a Dirac delta function, so I don't know if it's appropriate to use Kronecker delta function to approximate Green's function in k-Wave to compute Green's function. Using Kronecker delta function, I mean to set 1 pixel value of the source.p0 to be 1, and other pixel values to be zeros.&#60;/p&#62;
&#60;p&#62;Another relevant question is what the basis or expansion function is used in k-Wave. I mean if I have the initial pressure distribution source.p0 as a matrix, but I want to know the pressure between grid points, how to compute that from source.p0?&#60;/p&#62;
&#60;p&#62;Thanks in advanced!&#60;/p&#62;
&#60;p&#62;Best,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
