<?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: Photoacoustic Equation fwd solution for spherical excitation</title>
		<link>http://www.k-wave.org/forum/topic/photoacoustic-equation-fwd-solution-for-spherical-excitation</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Wed, 13 May 2026 00:51:10 +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/photoacoustic-equation-fwd-solution-for-spherical-excitation" rel="self" type="application/rss+xml" />

		<item>
			<title>bencox on "Photoacoustic Equation fwd solution for spherical excitation"</title>
			<link>http://www.k-wave.org/forum/topic/photoacoustic-equation-fwd-solution-for-spherical-excitation#post-4252</link>
			<pubDate>Sat, 28 Dec 2013 12:43:27 +0000</pubDate>
			<dc:creator>bencox</dc:creator>
			<guid isPermaLink="false">4252@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Prabodh, &#60;/p&#62;
&#60;p&#62;I think the problem is caused by the periodic boundary condition which is implicit when the FFT is used. It causes the waves leaving one side of the domain to appear immediately on the opposite side. One way to avoid it is to use a very large domain, but this quickly becomes impractical in 3D. An alternative is to put an absorbing boundary condition around the edge, which is what we've done in the function &#60;code&#62;kspaceFirstOrder3D&#60;/code&#62;. I recommend that you first setup an example in 2D using &#60;code&#62;kspaceFirstOrder2D&#60;/code&#62;, as it is easier to visualise and you can check it more easily, and then progress to a 3D example. It can be helpful to use one of the examples that comes with the toolbox as a template to get you started quicker.&#60;/p&#62;
&#60;p&#62;For the 3D case you may want to try the version which uses C++ code in the background as it runs several times faster than the Matlab version. The function is called &#60;code&#62;kspaceFirstOrder3DC&#60;/code&#62; and the details can be found in the manual under the documentation tab. Note that the binaries (or source code) need to be downloaded separately from the Toolbox.&#60;/p&#62;
&#60;p&#62;By the way, there is a k-Wave function for creating balls in 3D, &#60;code&#62;makeBall&#60;/code&#62;. Also, what you coded up is also included as a k-Wave function &#60;code&#62;kspaceSecondOrder&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;Good luck with your modelling!&#60;/p&#62;
&#60;p&#62;Ben
&#60;/p&#62;</description>
		</item>
		<item>
			<title>prabodh_iitk on "Photoacoustic Equation fwd solution for spherical excitation"</title>
			<link>http://www.k-wave.org/forum/topic/photoacoustic-equation-fwd-solution-for-spherical-excitation#post-4251</link>
			<pubDate>Sat, 28 Dec 2013 08:30:43 +0000</pubDate>
			<dc:creator>prabodh_iitk</dc:creator>
			<guid isPermaLink="false">4251@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Dear Sir,&#60;/p&#62;
&#60;p&#62;I have modified the matlab code given in the following chapter for modeling photoacoustic pressure in 3D for spherical excitation.&#60;/p&#62;
&#60;p&#62;B. T. Cox and P. C. Beard, &#34;Modeling Photoacoustic Propagation in Tissue Using k-Space Techniques,&#34; in Photoacoustic Imaging and Spectroscopy, L. V. Wang, Ed. London: CRC Press, 2009, pp. 25-34. ISBN-10:1420059912, ISBN-13:978-1420059915.&#60;/p&#62;
&#60;p&#62;Here is my code:&#60;br /&#62;
'&#60;br /&#62;
tic&#60;br /&#62;
clear all&#60;br /&#62;
clear&#60;br /&#62;
clc&#60;/p&#62;
&#60;p&#62;%MATLAB code for k-space model  in 3-dimensions acoustically homogenious media&#60;/p&#62;
&#60;p&#62;N=100; n=(-N/2:N/2-1)';  % 3- dim grid&#60;br /&#62;
v=1500; %mm/ms ----- sound velocity in medium&#60;br /&#62;
dx=4e-2; dy=4e-2; dz= 4e-2; %mm ---- size of voxel&#60;br /&#62;
[x,y,z]=meshgrid(n*dx,n*dy,n*dz); % grid construction&#60;br /&#62;
[kx,ky,kz] = meshgrid(n*2*pi/(N*dx),n*2*pi/(N*dy),n*2*pi/(N*dz)); % k-space grid construction&#60;br /&#62;
k = sqrt(kx.^2 + ky.^2+kz.^2); % &#60;/p&#62;
&#60;p&#62;x0= 1; % radius of spherical absorber in mm&#60;br /&#62;
dd= 30; % detector to center of absorber distance&#60;br /&#62;
rd= N/2; cd= N/2; zd= N/2+dd; % position of detector (voxel)&#60;/p&#62;
&#60;p&#62;p1= zeros(N,N,N);&#60;br /&#62;
for i= 1:N    %**************************************** SPHERICAL OBJECT&#60;br /&#62;
    for j= 1:N&#60;br /&#62;
        for l=1:N&#60;br /&#62;
        if ((i-N/2)^2+(j-N/2)^2+(l-N/2)^2)&#38;lt;(x0/dx)^2&#60;br /&#62;
            p1(i,j,l)=1; % initital pressure in the object&#60;br /&#62;
        end&#60;br /&#62;
        end&#60;br /&#62;
    end&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;p0fft=(fftshift(fftn(p1)));% 3-d FFT of initial pressure&#60;br /&#62;
t_samp= 100; % # of time samples&#60;br /&#62;
t_s= 0;% starting time for data acquisiation&#60;br /&#62;
t_e=1.6e-3; % ending time&#60;br /&#62;
dt= (t_e-t_s)/t_samp; % sampling period&#60;br /&#62;
t1= (t_s:dt:t_e-dt);&#60;br /&#62;
for t_t=1:length(t1)&#60;br /&#62;
    p = (ifftn(fftshift(p0fft.*cos(v*k*t1(t_t)))));&#60;br /&#62;
    P_d (t_t)=p (rd,cd,zd);&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;%% rectangular windowing&#60;br /&#62;
%     X= P_d';&#60;br /&#62;
%      Y= fft (X);&#60;br /&#62;
%  Y1= (fftshift(Y));&#60;br /&#62;
%  Y2= zeros(t_samp,1);&#60;br /&#62;
%  for i=1:t_samp&#60;br /&#62;
%      if i&#38;lt;t_samp/2-0.1*t_samp&#60;br /&#62;
%      Y2(i,1)= 0;&#60;br /&#62;
%      elseif i&#38;gt;t_samp/2+0.1*t_samp+2&#60;br /&#62;
%          Y2(i,1)=0;&#60;br /&#62;
%      else&#60;br /&#62;
%          Y2(i,1)= Y1(i,1);&#60;br /&#62;
%      end&#60;br /&#62;
%  end&#60;br /&#62;
%&#60;br /&#62;
% Z= ifftshift((Y2));&#60;br /&#62;
% Zr= ifft(Z);&#60;/p&#62;
&#60;p&#62;%% analytical pressure at detector&#60;br /&#62;
 P_an= zeros(1,100);&#60;br /&#62;
 P_an= (heaviside(x0-abs(dd*dz-v*t1))).*(dd*dz-v*t1)/(2*dz*dd);&#60;/p&#62;
&#60;p&#62; %% Comparision of results&#60;br /&#62;
figure,plot (t1,P_d,'r') % simulated result&#60;br /&#62;
hold on&#60;br /&#62;
% plot(t1,Zr,'k') % simulated result after windowing&#60;br /&#62;
% hold on&#60;br /&#62;
plot(t1,P_an) % analytical result&#60;br /&#62;
hold off&#60;/p&#62;
&#60;p&#62;toc&#60;br /&#62;
'&#60;/p&#62;
&#60;p&#62;But the solution is not matching with the analytical solution.&#60;br /&#62;
Please have a look at the figure:&#60;br /&#62;
&#60;a href=&#34;http://imageshack.com/a/img203/8402/s61o.jpg&#34; rel=&#34;nofollow&#34;&#62;http://imageshack.com/a/img203/8402/s61o.jpg&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Kindly let me know where am I doing it wrong.&#60;/p&#62;
&#60;p&#62;Thank you.&#60;/p&#62;
&#60;p&#62;Regards&#60;br /&#62;
Prabodh
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
