<?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: recreate plot from paper</title>
		<link>http://www.k-wave.org/forum/topic/recreate-plot-from-paper</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:38:57 +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/recreate-plot-from-paper" rel="self" type="application/rss+xml" />

		<item>
			<title>jgazagnaire on "recreate plot from paper"</title>
			<link>http://www.k-wave.org/forum/topic/recreate-plot-from-paper#post-8537</link>
			<pubDate>Wed, 18 May 2022 20:12:41 +0000</pubDate>
			<dc:creator>jgazagnaire</dc:creator>
			<guid isPermaLink="false">8537@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, maybe this has gotten lost in the pile. I hoping by reposting my question it will resurface. I will also try to keep my question to the point.&#60;/p&#62;
&#60;p&#62;Can you tell me if the absorption coefficient and power exponent are being used when creating the plot in the above paper, (specifically figure 3b)? if so, then I will use the values in table 1 for the alpha coefficient, but what should the power exponent be?&#60;/p&#62;
&#60;p&#62;thank you,&#60;br /&#62;
Julia
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jgazagnaire on "recreate plot from paper"</title>
			<link>http://www.k-wave.org/forum/topic/recreate-plot-from-paper#post-8496</link>
			<pubDate>Mon, 11 Apr 2022 19:02:14 +0000</pubDate>
			<dc:creator>jgazagnaire</dc:creator>
			<guid isPermaLink="false">8496@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, just checking in. My ultimate goal is to generate a plot the reflection coefficient error as a function of the impedance ratio. There is a plot (Fig 4) in the above mentioned paper that has the transmission coefficient error as a function of impedance ratio. As a first step, I just wanted to generate the plot in Figure 3 to make sure that I was doing the process correctly. Any suggestions would be appreciated.&#60;br /&#62;
Thank you!&#60;br /&#62;
Julia
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jgazagnaire on "recreate plot from paper"</title>
			<link>http://www.k-wave.org/forum/topic/recreate-plot-from-paper#post-8478</link>
			<pubDate>Wed, 16 Mar 2022 19:22:39 +0000</pubDate>
			<dc:creator>jgazagnaire</dc:creator>
			<guid isPermaLink="false">8478@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Brad, Thank you. I am ashamed to admit that I didn't see that the first time I went through the paper. I have since coded it up, but I do have a couple of questions.&#60;br /&#62;
1.Because the alpha coefficients are listed in table 1 for the bone and brain I am assuming absorption is taken into account. What about dispersion, is it assumed that the medium is dispersive, if so what should the power coefficient be set to?&#60;br /&#62;
2.When estimating the transmission coefficient using the FFT, do I need to apply a gain to compensate for the difference in losses occurring due to the different absorption rates in the two media?&#60;br /&#62;
I have pasted my code below:&#60;br /&#62;
I commented out the absorption with no dispersion. I get large error when I include them.&#60;br /&#62;
I am using the sound speeds from table 1 to calculate the impedance for the theoretical Transmission and Reflection coefficients, which are used to calculate the error for the plot.&#60;/p&#62;
&#60;p&#62;clearvars;&#60;br /&#62;
close all&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% SIMULATION&#60;br /&#62;
% =========================================================================&#60;br /&#62;
% parameter values from paper&#60;br /&#62;
rho_brain       = 1040;&#60;br /&#62;
rho_bone        = 1990;&#60;br /&#62;
c_brain         = 1560;&#60;br /&#62;
c_bone          = 3200;&#60;br /&#62;
alpha__brain    = 0.58;&#60;br /&#62;
alpha__bone     = 3.5;&#60;/p&#62;
&#60;p&#62;% create the computational grid using info from paper&#60;br /&#62;
Nx      = 4096;       % number of grid points in the x (row) direction&#60;br /&#62;
gridLen = 0.1;&#60;br /&#62;
dx      =  gridLen/Nx;   % grid point spacing in the x direction [m]&#60;br /&#62;
kgrid   = kWaveGrid(Nx, dx);&#60;/p&#62;
&#60;p&#62;% assign parameters for simulation for bone to brain&#60;br /&#62;
rho_1           = rho_bone;%&#60;br /&#62;
rho_2           = rho_brain;%&#60;br /&#62;
c_1             = c_bone;%&#60;br /&#62;
c_2             = c_brain;%&#60;br /&#62;
alpha_c_1       = alpha__bone;&#60;br /&#62;
alpha_c_2       = alpha__brain;&#60;/p&#62;
&#60;p&#62;% % assign parameters for simulation for brain to bone&#60;br /&#62;
% rho_1           = rho_brain; %&#60;br /&#62;
% rho_2           = rho_bone;%&#60;br /&#62;
% c_1             = c_brain; %&#60;br /&#62;
% c_2             = c_bone;%&#60;br /&#62;
% alpha_c_1       = alpha__brain;&#60;br /&#62;
% alpha_c_2       = alpha__bone;&#60;/p&#62;
&#60;p&#62;%  parameters needed for coefficient calcs&#60;br /&#62;
z1          = rho_1*c_1;&#60;br /&#62;
z2          = rho_2*c_2;&#60;/p&#62;
&#60;p&#62;Rpr_True = (z2-z1)/(z2+z1);&#60;/p&#62;
&#60;p&#62;Tpr_True = (z2/z1)*(1-Rpr_True);&#60;/p&#62;
&#60;p&#62;%% Run K-wave model&#60;br /&#62;
% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed                      = c_1 * ones(Nx, 1);        % [m/s]&#60;br /&#62;
medium.sound_speed(round(Nx/2)+1:end)   = c_2;                      % [m/s]&#60;br /&#62;
medium.density                          = rho_1 * ones(Nx, 1);    	% [kg/m^3]&#60;br /&#62;
medium.density(round(Nx/2)+1:end)       = rho_2;                    % [kg/m^3]&#60;br /&#62;
% medium.alpha_mode                       = 'no_dispersion';&#60;br /&#62;
% medium.alpha_power                      = 1;&#60;br /&#62;
% medium.alpha_coeff                      = alpha_c_1*ones(Nx, 1);&#60;br /&#62;
% medium.alpha_coeff(round(Nx/2)+1:end)   = alpha_c_2;&#60;/p&#62;
&#60;p&#62;source.p0 = zeros(Nx,1);&#60;br /&#62;
source.p0(500) = 1;&#60;/p&#62;
&#60;p&#62;% % % create a Cartesian sensor mask&#60;br /&#62;
sensor.mask     = [-0.0256, 0.0256];% [-dx,dx]; % [m]&#60;/p&#62;
&#60;p&#62;% set the simulation time to capture the reflections&#60;br /&#62;
t_end           = 2.5 * kgrid.x_size / max(medium.sound_speed(:));&#60;/p&#62;
&#60;p&#62;% define the time array&#60;br /&#62;
kgrid.makeTime(medium.sound_speed, [], t_end);&#60;br /&#62;
sensor.record	= {'p'};&#60;br /&#62;
fs = 1/(kgrid.dt);&#60;br /&#62;
% run the simulation&#60;br /&#62;
sensor_data_het     = kspaceFirstOrder1D(kgrid, medium, source, sensor, 'RecordMovie', false,'PlotLayout', true );%&#60;/p&#62;
&#60;p&#62;% % isolate incident, reflected and transmitted signals - bone to brain&#60;br /&#62;
%&#60;br /&#62;
IncWin = sensor_data_het.p(1,1000:3000-1);&#60;br /&#62;
RefWin = sensor_data_het.p(1,8000:10000-1);&#60;br /&#62;
TransWin = sensor_data_het.p(2,12000:14000-1);&#60;/p&#62;
&#60;p&#62;% isolate incident, reflected and transmitted signals - brain to bone&#60;br /&#62;
%&#60;br /&#62;
% IncWin = sensor_data_het.p(1,2500:4500-1);&#60;br /&#62;
% RefWin = sensor_data_het.p(1,17500:19500-1);&#60;br /&#62;
% TransWin = sensor_data_het.p(2,13500:15500-1);&#60;/p&#62;
&#60;p&#62;% get spectrum of signals&#60;br /&#62;
[fVec_ip,IP_F_kw] = spect(IncWin,fs,'PowerTwo',true);&#60;br /&#62;
[fVec_tp,TP_F_kw] = spect(TransWin,fs,'PowerTwo',true);&#60;br /&#62;
[fVec_rp,RP_F_kw] = spect(RefWin,fs,'PowerTwo',true);&#60;/p&#62;
&#60;p&#62;TC_F_kw = abs(TP_F_kw)./abs(IP_F_kw);&#60;br /&#62;
RC_F_kw = abs(RP_F_kw)./abs(IP_F_kw);&#60;/p&#62;
&#60;p&#62;PPW_kw = c_2./(dx*fVec_ip);&#60;/p&#62;
&#60;p&#62;% percent error&#60;br /&#62;
Rpr_True = abs(Rpr_True);&#60;br /&#62;
Tp_Error = 100*((TC_F_kw-Tpr_True)./Tpr_True);&#60;br /&#62;
Rp_Error = 100*((RC_F_kw-Rpr_True)./Rpr_True);&#60;/p&#62;
&#60;p&#62;figure;plot(PPW_kw,Tp_Error);title('Percent Error as a function of PPW')&#60;br /&#62;
hold on;plot(PPW_kw,Rp_Error);legend('transmission error','reflection error')&#60;br /&#62;
xlabel('PPW')&#60;br /&#62;
ylabel('Percent Error')&#60;br /&#62;
% xlim([2 10])&#60;br /&#62;
% ylim([-30 30])&#60;br /&#62;
grid
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "recreate plot from paper"</title>
			<link>http://www.k-wave.org/forum/topic/recreate-plot-from-paper#post-8456</link>
			<pubDate>Mon, 14 Feb 2022 20:27:40 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">8456@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Julia,&#60;/p&#62;
&#60;p&#62;This plot was calculated using a single simulation with a short pulse (&#60;code&#62;source.p0&#60;/code&#62; with a single point), recording and taking an FFT of the incident, reflected, and transmitted waves, and then converting the frequency axis to PPW.&#60;/p&#62;
&#60;p&#62;Hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jgazagnaire on "recreate plot from paper"</title>
			<link>http://www.k-wave.org/forum/topic/recreate-plot-from-paper#post-8453</link>
			<pubDate>Fri, 04 Feb 2022 16:20:54 +0000</pubDate>
			<dc:creator>jgazagnaire</dc:creator>
			<guid isPermaLink="false">8453@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, I am trying to recreate figure 3 from the 2014 IEEE paper &#34;Quantifying Numerical Errors in the Simulation of Transcranial Ultrasound using Pseudospectral Methods&#34; by Robertson, Cox and Treeby, I am only interested in the transmission and reflection coefficient error curves using K-space and not FDTD. I calculated the dx using the Nx of 4096 and total length of 0.1 m which are given in the paper. This results in a dx of 2.44e-5. If I am looking at both mediums, brain and bone, the minimum sound speed is for the brain at 1560 m/s. With a PPW = 2 then the f0 = 31.94 Mhz. I would then just reduce dx to achieve the various PPWs.&#60;br /&#62;
Can you tell me if my assumptions are correct?&#60;br /&#62;
thank you!&#60;br /&#62;
Julia
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
