<?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: HIFU Wave through a heterogenous medium</title>
		<link>http://www.k-wave.org/forum/topic/hifu-wave-through-a-heterogenous-medium</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:32:55 +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/hifu-wave-through-a-heterogenous-medium" rel="self" type="application/rss+xml" />

		<item>
			<title>scmmw on "HIFU Wave through a heterogenous medium"</title>
			<link>http://www.k-wave.org/forum/topic/hifu-wave-through-a-heterogenous-medium#post-9242</link>
			<pubDate>Tue, 13 Jan 2026 16:35:52 +0000</pubDate>
			<dc:creator>scmmw</dc:creator>
			<guid isPermaLink="false">9242@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, I'm trying to simulate a HIFU wave propagating through a heterogeneous medium (water, soft tissue, muscle, thyroid, and nodule). My simulation works as expected at 2 MHz, producing a lesion at the focus point. However, at 3 MHz, side lesions appear instead of a lesion at the focus. I'm unsure how to resolve this issue. Any help would be greatly appreciated!&#60;/p&#62;
&#60;p&#62;Here is my script (I have a lot of visualisations, this is just to help me understand the process)&#60;/p&#62;
&#60;p&#62;clearvars;&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% ACOUSTIC SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;%% define the PML size&#60;br /&#62;
pml_size = 20;              % [grid points]&#60;/p&#62;
&#60;p&#62;% define the grid parameters&#60;br /&#62;
Nx = 524 - 2 * pml_size;    % [grid points]&#60;br /&#62;
Ny = 427 - 2 * pml_size;    % [grid points]&#60;br /&#62;
dx = 206e-6;               % [m]&#60;br /&#62;
dy = 206e-6;               % [m]&#60;/p&#62;
&#60;p&#62;% create the computational grid&#60;br /&#62;
kgrid = kWaveGrid(Nx, dx, Ny, dy);&#60;/p&#62;
&#60;p&#62;% define the properties of the propagation medium&#60;br /&#62;
medium.sound_speed = zeros(Nx,Ny);  % [m/s]&#60;br /&#62;
medium.density     = zeros(Nx,Ny);  % [kg/m^3]&#60;br /&#62;
medium.alpha_coeff = zeros(Nx,Ny);  % [dB/(MHz^y cm)]&#60;/p&#62;
&#60;p&#62;water.sound_speed          = 1480;&#60;br /&#62;
water.density              = 1000;  % [kg/m^3]&#60;br /&#62;
water.alpha_coeff          = 0.0022;     % [dB/(MHz^y cm)]&#60;br /&#62;
water.alpha_power          = 1;&#60;/p&#62;
&#60;p&#62;tissue.sound_speed          = 1540;&#60;br /&#62;
tissue.density              = 1020;  % [kg/m^3]&#60;br /&#62;
tissue.alpha_coeff          = 0.75;  % [dB/(MHz^y cm)]&#60;br /&#62;
tissue.alpha_power          = 1.5;&#60;/p&#62;
&#60;p&#62;muscle.sound_speed          = 1588;&#60;br /&#62;
muscle.density              = 1090;  % [kg/m^3]&#60;br /&#62;
muscle.alpha_coeff          = 0.63;  % [dB/(MHz^y cm)]&#60;br /&#62;
muscle.alpha_power          = 1.3;&#60;/p&#62;
&#60;p&#62;thyroid.sound_speed          = 1585;&#60;br /&#62;
thyroid.density              = 1050;  % [kg/m^3]&#60;br /&#62;
thyroid.alpha_coeff          = 1.34;     % [dB/(MHz^y cm)]&#60;br /&#62;
thyroid.alpha_power          = 1.5;&#60;/p&#62;
&#60;p&#62;nodule.sound_speed          = 1583;&#60;br /&#62;
nodule.density              = 1080;  % [kg/m^3]&#60;br /&#62;
nodule.alpha_coeff          = 0.31;     % [dB/(MHz^y cm)]&#60;br /&#62;
nodule.alpha_power          = 1.1;&#60;/p&#62;
&#60;p&#62;% now break down the grid&#60;br /&#62;
% --- Water region -------------------------------------------------------&#60;br /&#62;
medium.sound_speed(1:156, :)     = water.sound_speed;&#60;br /&#62;
medium.density(1:156, :)         = water.density;&#60;br /&#62;
medium.alpha_coeff(1:156, :)     = water.alpha_coeff;&#60;/p&#62;
&#60;p&#62;% --- Tissue region -------------------------------------------------------&#60;br /&#62;
medium.sound_speed(157:341, :)     = tissue.sound_speed;&#60;br /&#62;
medium.density(157:341, :)         = tissue.density;&#60;br /&#62;
medium.alpha_coeff(157:341, :)     = tissue.alpha_coeff;&#60;br /&#62;
%medium.alpha_power(1:185, :)     = tissue.alpha_power;&#60;/p&#62;
&#60;p&#62;% --- Muscle region -------------------------------------------------------&#60;br /&#62;
medium.sound_speed(342:416, :)   = muscle.sound_speed;&#60;br /&#62;
medium.density(342:416, :)       = muscle.density;&#60;br /&#62;
medium.alpha_coeff(342:416, :)   = muscle.alpha_coeff;&#60;br /&#62;
%medium.alpha_power(186:260, :)   = muscle.alpha_power;&#60;/p&#62;
&#60;p&#62;% --- Thyroid region ------------------------------------------------------&#60;br /&#62;
medium.sound_speed(417:427, :)   = thyroid.sound_speed;&#60;br /&#62;
medium.density(417:427, :)       = thyroid.density;&#60;br /&#62;
medium.alpha_coeff(417:427, :)   = thyroid.alpha_coeff;&#60;br /&#62;
%medium.alpha_power(261:270, :)   = thyroid.alpha_power;&#60;/p&#62;
&#60;p&#62;% --- Nodule region -------------------------------------------------------&#60;br /&#62;
medium.sound_speed(427:end, :)    = nodule.sound_speed;&#60;br /&#62;
medium.density(427:end, :)        = nodule.density;&#60;br /&#62;
medium.alpha_coeff(427:end, :)    = nodule.alpha_coeff;&#60;br /&#62;
%medium.alpha_power(271:end, :)    = nodule.alpha_power;&#60;/p&#62;
&#60;p&#62;medium.sound_speed = smooth(medium.sound_speed, true);&#60;br /&#62;
medium.density     = smooth(medium.density, true);&#60;br /&#62;
medium.alpha_coeff = smooth(medium.alpha_coeff, true);&#60;/p&#62;
&#60;p&#62;% define the source parameters&#60;br /&#62;
diameter = 64e-3;           % [m]&#60;br /&#62;
radius   = 63.2e-3;         % [m]&#60;br /&#62;
aperture = 20e-3;           % [m]&#60;br /&#62;
freq     = 2e6;           % [Hz]&#60;br /&#62;
amp      = 0.5e6;           % [Pa]&#60;/p&#62;
&#60;p&#62;%% This may need running a few times to optimise alphafit to get best fit power value i.e. lines overlap as best as possible.&#60;br /&#62;
alpha_coeff_vec = [water.alpha_coeff, tissue.alpha_coeff, muscle.alpha_coeff, thyroid.alpha_coeff, nodule.alpha_coeff];&#60;br /&#62;
alpha_power_vec = [water.alpha_power,tissue.alpha_power, muscle.alpha_power, thyroid.alpha_power, nodule.alpha_power];&#60;br /&#62;
c_vec           = [water.sound_speed, tissue.sound_speed, muscle.sound_speed, thyroid.sound_speed, nodule.sound_speed];&#60;br /&#62;
alphaFit    = 1.5;&#60;br /&#62;
alpha_coeff_fit_vec = fitPowerLawParamsMulti(alpha_coeff_vec, alpha_power_vec, c_vec, freq, alphaFit, true);&#60;/p&#62;
&#60;p&#62;medium.alpha_power = alphaFit;&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
% --- Tissue ---&#60;br /&#62;
medium.alpha_coeff(1:156, :)  = alpha_coeff_fit_vec(1);&#60;/p&#62;
&#60;p&#62;% --- Tissue ---&#60;br /&#62;
medium.alpha_coeff(157:341, :) = alpha_coeff_fit_vec(2);&#60;/p&#62;
&#60;p&#62;% --- Muscle ---&#60;br /&#62;
medium.alpha_coeff(342:416, :)  = alpha_coeff_fit_vec(3);&#60;/p&#62;
&#60;p&#62;% --- Thyroid ---&#60;br /&#62;
medium.alpha_coeff(417:427, :)  = alpha_coeff_fit_vec(4);&#60;/p&#62;
&#60;p&#62;% --- Nodule ---&#60;br /&#62;
medium.alpha_coeff(427:end, :)   = alpha_coeff_fit_vec(5);&#60;/p&#62;
&#60;p&#62;%%&#60;br /&#62;
close all&#60;/p&#62;
&#60;p&#62;source.p_mask = zeros(Nx,Ny);&#60;/p&#62;
&#60;p&#62;% define a focused ultrasound transducer&#60;/p&#62;
&#60;p&#62;null_mask     = makeArc([Nx, Ny], [1, Ny/2], round(radius / dx), round(aperture / dx), [Nx/2, Ny/2]); % define aperture in transducer&#60;br /&#62;
source.p_mask = source.p_mask + makeArc([Nx, Ny], [1, Ny/2], round(radius / dx), round(diameter / dx), [Nx/2, Ny/2]) - null_mask;&#60;/p&#62;
&#60;p&#62;% calculate the time step using an integer number of points per period&#60;br /&#62;
ppw = mean(mean(medium.sound_speed)) / (freq * dx); % points per wavelength&#60;br /&#62;
cfl = 0.3;                              % cfl number&#60;br /&#62;
ppp = ceil(ppw / cfl);                  % points per period&#60;br /&#62;
T   = 1 / freq;                         % period [s]&#60;br /&#62;
dt  = T / ppp;                          % time step [s]&#60;/p&#62;
&#60;p&#62;% calculate the number of time steps to reach steady state&#60;br /&#62;
t_end = sqrt( kgrid.x_size.^2 + kgrid.y_size.^2 ) / mean(mean(medium.sound_speed));&#60;br /&#62;
Nt = round(t_end / dt);&#60;/p&#62;
&#60;p&#62;% create the time array&#60;br /&#62;
kgrid.setTime(Nt, dt);&#60;/p&#62;
&#60;p&#62;% define the input signal&#60;br /&#62;
source.p = createCWSignals(kgrid.t_array, freq, amp, 0);&#60;/p&#62;
&#60;p&#62;% set the sensor mask to cover the entire grid&#60;br /&#62;
sensor.mask = ones(Nx, Ny);&#60;br /&#62;
sensor.record = {'p', 'p_max_all'};&#60;/p&#62;
&#60;p&#62;% record the last 3 cycles in steady state&#60;br /&#62;
num_periods = 3;&#60;br /&#62;
T_points = round(num_periods * T / kgrid.dt);&#60;br /&#62;
sensor.record_start_index = Nt - T_points + 1;&#60;/p&#62;
&#60;p&#62;% set the input arguements&#60;br /&#62;
input_args = {'PMLInside', false, 'PlotPML', false, 'DisplayMask', ...&#60;br /&#62;
    'off', 'PlotScale', [-1, 1] * amp};&#60;/p&#62;
&#60;p&#62;% run the acoustic simulation&#60;br /&#62;
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% CALCULATE HEATING&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% convert the absorption coefficient to nepers/m&#60;br /&#62;
alpha_np = db2neper(medium.alpha_coeff, medium.alpha_power) * ...&#60;br /&#62;
    (2 * pi * freq).^medium.alpha_power;&#60;/p&#62;
&#60;p&#62;% extract the pressure amplitude at each position&#60;br /&#62;
p = extractAmpPhase(sensor_data.p, 1/kgrid.dt, freq);&#60;/p&#62;
&#60;p&#62;% reshape the data, and calculate the volume rate of heat deposition&#60;br /&#62;
p = reshape(p, Nx, Ny);&#60;br /&#62;
Q = alpha_np .* p.^2 ./ (medium.density .* medium.sound_speed);&#60;/p&#62;
&#60;p&#62;% Find the location of maximum heat deposition&#60;br /&#62;
[maxQ, idxMaxQ] = max(Q(:));&#60;br /&#62;
[rowMax, colMax] = ind2sub(size(Q), idxMaxQ);&#60;/p&#62;
&#60;p&#62;% Place the thermal sensor at that location&#60;br /&#62;
sensor.mask = zeros(Nx, Ny);&#60;br /&#62;
sensor.mask(rowMax, colMax) = 1;&#60;/p&#62;
&#60;p&#62;% Report coordinates&#60;br /&#62;
fprintf('Thermal sensor placed at row=%d, col=%d (x=%.3f m, y=%.3f m)\n', ...&#60;br /&#62;
    rowMax, colMax, kgrid.x_vec(rowMax), kgrid.y_vec(colMax));&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% THERMAL SIMULATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% clear the input structures&#60;br /&#62;
%clear source sensor; %medium&#60;/p&#62;
&#60;p&#62;% set the background temperature and heating term&#60;br /&#62;
source.Q  = Q;&#60;br /&#62;
source.T0 = 37;&#60;/p&#62;
&#60;p&#62;medium.thermal_conductivity = zeros(Nx,Ny); % [W/(m.K)]&#60;br /&#62;
medium.specific_heat        = zeros(Nx,Ny); % [J/(kg.K)]&#60;/p&#62;
&#60;p&#62;water.thermal_conductivity = 0.598; % [W/(m.K)]&#60;br /&#62;
water.specific_heat        = 4200;  % [J/(kg.K)]&#60;/p&#62;
&#60;p&#62;tissue.thermal_conductivity = 0.5;   % [W/(m.K)]&#60;br /&#62;
tissue.specific_heat        = 3600;  % [J/(kg.K)]&#60;/p&#62;
&#60;p&#62;muscle.thermal_conductivity = 	0.49;&#60;br /&#62;
muscle.specific_heat = 3421;&#60;/p&#62;
&#60;p&#62;thyroid.thermal_conductivity = 0.5;&#60;br /&#62;
thyroid.specific_heat = 3826;&#60;/p&#62;
&#60;p&#62;nodule.thermal_conductivity = 0.5;&#60;br /&#62;
nodule.specific_heat = 3826;&#60;/p&#62;
&#60;p&#62;% --- Water region -------------------------------------------------------&#60;br /&#62;
medium.thermal_conductivity(1:156, :)     = water.thermal_conductivity;&#60;br /&#62;
medium.specific_heat(1:156, :)       = water.specific_heat;&#60;/p&#62;
&#60;p&#62;% --- Tissue region -------------------------------------------------------&#60;br /&#62;
medium.thermal_conductivity(157:341, :)    = tissue.thermal_conductivity;&#60;br /&#62;
medium.specific_heat(157:341, :)        = tissue.specific_heat;&#60;/p&#62;
&#60;p&#62;% --- Muscle region -------------------------------------------------------&#60;br /&#62;
medium.thermal_conductivity(342:416, :)   = muscle.thermal_conductivity;&#60;br /&#62;
medium.specific_heat(342:416, :)       = muscle.specific_heat;&#60;/p&#62;
&#60;p&#62;% --- Thyroid region ------------------------------------------------------&#60;br /&#62;
medium.thermal_conductivity(417:427, :)  = thyroid.thermal_conductivity;&#60;br /&#62;
medium.specific_heat(417:427, :)      = thyroid.specific_heat;&#60;/p&#62;
&#60;p&#62;% --- Nodule region -------------------------------------------------------&#60;br /&#62;
medium.thermal_conductivity(427:end, :)     = nodule.thermal_conductivity;&#60;br /&#62;
medium.specific_heat(427:end, :)       = nodule.specific_heat;&#60;/p&#62;
&#60;p&#62;% create kWaveDiffusion object&#60;br /&#62;
kdiff = kWaveDiffusion(kgrid, medium, source, sensor);&#60;/p&#62;
&#60;p&#62;% set source on time and off time&#60;br /&#62;
on_time  = 10;  % [s]&#60;br /&#62;
off_time = 200;  % [s]&#60;/p&#62;
&#60;p&#62;% set time step size&#60;br /&#62;
dt = 0.1;&#60;/p&#62;
&#60;p&#62;% Number of timesteps for the entire heating period&#60;br /&#62;
num_steps = round(on_time / dt);&#60;/p&#62;
&#60;p&#62;% Initialize a container for CEM43 values at each timestep&#60;br /&#62;
cem43_values = zeros(1, num_steps);&#60;/p&#62;
&#60;p&#62;% Initialize variable to store the time when CEM43 exceeds 240&#60;br /&#62;
time_cem43_exceeded = NaN;  % Default to NaN (not exceeded yet)&#60;/p&#62;
&#60;p&#62;% Iterate over each timestep&#60;br /&#62;
for step = 1:num_steps&#60;br /&#62;
    % Take one timestep&#60;br /&#62;
    kdiff.takeTimeStep(1, dt);&#60;/p&#62;
&#60;p&#62;    % Record CEM43 value at the sensor location&#60;br /&#62;
    cem43_values(step) = max(kdiff.cem43(sensor.mask == 1));  % Assuming you want the max CEM43 at the sensor position&#60;/p&#62;
&#60;p&#62;    % Display the CEM43 value and time&#60;br /&#62;
    %fprintf('Time: %.2f s, CEM43: %.2f\n', step * dt, cem43_values(step));&#60;/p&#62;
&#60;p&#62;    % Check if CEM43 exceeds 240&#60;br /&#62;
    if cem43_values(step) &#38;gt;= 240 &#38;amp;&#38;amp; isnan(time_cem43_exceeded)&#60;br /&#62;
        time_cem43_exceeded = step * dt;  % Record the time when it exceeds 240&#60;br /&#62;
        fprintf('CEM43 exceeded 240 at time %.2f s.\n', time_cem43_exceeded);&#60;br /&#62;
    end&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% After the loop, you can use time_cem43_exceeded to check when the threshold was met&#60;br /&#62;
if ~isnan(time_cem43_exceeded)&#60;br /&#62;
    fprintf('CEM43 exceeded 240 at %.2f seconds during the simulation.\n', time_cem43_exceeded);&#60;br /&#62;
else&#60;br /&#62;
    disp('CEM43 did not exceed 240 during the simulation.');&#60;br /&#62;
end&#60;/p&#62;
&#60;p&#62;% store the current temperature field&#60;br /&#62;
T1 = kdiff.T;&#60;br /&#62;
    if max(max(T1)) &#38;gt;= 100&#60;br /&#62;
        disp('Boiling occured');&#60;br /&#62;
    end&#60;/p&#62;
&#60;p&#62;% turn off heat source and take time steps&#60;br /&#62;
kdiff.Q = 0;&#60;br /&#62;
kdiff.takeTimeStep(round(off_time / dt), dt);&#60;/p&#62;
&#60;p&#62;% store the current temperature field&#60;br /&#62;
T2 = kdiff.T;&#60;/p&#62;
&#60;p&#62;[max_dose, idx_dose] = max(kdiff.cem43(:));  % Find max thermal dose and index&#60;br /&#62;
[row_dose, col_dose] = ind2sub(size(kdiff.cem43), idx_dose);  % Get coordinates&#60;/p&#62;
&#60;p&#62;% Get the x and y coordinates of the maximum thermal dose&#60;br /&#62;
center_x_dose = kgrid.x_vec(row_dose);&#60;br /&#62;
center_y_dose = kgrid.y_vec(col_dose);&#60;/p&#62;
&#60;p&#62;% Display the result&#60;br /&#62;
disp(['Center of Thermal Dose: x = ', num2str(center_x_dose), ' m, y = ', num2str(center_y_dose), ' m']);&#60;br /&#62;
disp(['Center of Thermal Dose: x = ', num2str(row_dose), ' , y = ', num2str(col_dose), ' ']);&#60;/p&#62;
&#60;p&#62;%% break&#60;/p&#62;
&#60;p&#62;% =========================================================================&#60;br /&#62;
% VISUALISATION&#60;br /&#62;
% =========================================================================&#60;/p&#62;
&#60;p&#62;% Define the intensity threshold for ablated tissue&#60;br /&#62;
threshold = 0.99; % Values close to 1 indicate ablated tissue&#60;/p&#62;
&#60;p&#62;% Create a binary mask of the ablated region&#60;br /&#62;
binary_mask = kdiff.lesion_map &#38;gt;= threshold;&#60;/p&#62;
&#60;p&#62;% Find the rows and columns where the ablated tissue exists&#60;br /&#62;
[row_idx, col_idx] = find(binary_mask);&#60;/p&#62;
&#60;p&#62;% Add half the grid spacing to account for pixel edges&#60;br /&#62;
min_x = min(kgrid.x_vec(row_idx)) - abs(kgrid.x_vec(2) - kgrid.x_vec(1)) / 2;&#60;br /&#62;
max_x = max(kgrid.x_vec(row_idx)) + abs(kgrid.x_vec(2) - kgrid.x_vec(1)) / 2;&#60;br /&#62;
min_y = min(kgrid.y_vec(col_idx)) - abs(kgrid.y_vec(2) - kgrid.y_vec(1)) / 2;&#60;br /&#62;
max_y = max(kgrid.y_vec(col_idx)) + abs(kgrid.y_vec(2) - kgrid.y_vec(1)) / 2;&#60;/p&#62;
&#60;p&#62;% Compute the adjusted dimensions&#60;br /&#62;
length_ablated = (max_x - min_x) * 1e3; % in mm&#60;br /&#62;
width_ablated = (max_y - min_y) * 1e3;  % in mm&#60;/p&#62;
&#60;p&#62;% Display the results&#60;br /&#62;
fprintf('Ablated Tissue Dimensions:\n');&#60;br /&#62;
fprintf('Length: %.2f mm\n', length_ablated);&#60;br /&#62;
fprintf('Width: %.2f mm\n', width_ablated);&#60;/p&#62;
&#60;p&#62;% Optional: Visualize the lesion map with bounding box&#60;br /&#62;
figure;&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, kdiff.lesion_map, [0, 1]);&#60;br /&#62;
colorbar;&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Ablated Tissue');&#60;/p&#62;
&#60;p&#62;% Use adjusted bounds in the rectangle function&#60;br /&#62;
rectangle('Position', [min_y * 1e3, min_x * 1e3, ...&#60;br /&#62;
          width_ablated, length_ablated], ...&#60;br /&#62;
          'EdgeColor', 'r', 'LineWidth', 1.5);&#60;/p&#62;
&#60;p&#62;% Create time axis for the recorded data&#60;br /&#62;
t_axis = (0:kdiff.time_steps_taken - 1) * dt;&#60;/p&#62;
&#60;p&#62;% Plot temperature at every grid point (optional: you can visualize data at a specific point)&#60;br /&#62;
figure;&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, kdiff.sensor_data(:,:,end));  % Plot temperature at last time step&#60;br /&#62;
colorbar;&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
title('Temperature at Last Time Step');&#60;/p&#62;
&#60;p&#62;% Plot temperature time profile&#60;br /&#62;
figure;&#60;br /&#62;
plot(t_axis, kdiff.sensor_data, 'LineWidth', 1.5); % Enhanced line width for better visibility&#60;br /&#62;
xlabel('Time [s]');&#60;br /&#62;
ylabel('Temperature [^\circC]');&#60;/p&#62;
&#60;p&#62;% Add grid lines&#60;br /&#62;
grid on; % Turns on the grid&#60;/p&#62;
&#60;p&#62;% Customize y-axis ticks&#60;br /&#62;
ylim([floor(min(kdiff.sensor_data(:))), ceil(max(kdiff.sensor_data(:)))]); % Ensure y-axis limits encompass the data&#60;br /&#62;
yticks(floor(min(kdiff.sensor_data(:))):1:ceil(max(kdiff.sensor_data(:)))); % Set ticks with a step of 1&#60;/p&#62;
&#60;p&#62;% Optionally add a title&#60;br /&#62;
title('Temperature Time Profile');&#60;/p&#62;
&#60;p&#62;% plot the thermal dose and lesion map&#60;br /&#62;
figure;&#60;/p&#62;
&#60;p&#62;% plot the acoustic pressure&#60;br /&#62;
subplot(2, 3, 1);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, p * 1e-6);&#60;br /&#62;
h = colorbar;&#60;br /&#62;
xlabel(h, '[MPa]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Acoustic Pressure Amplitude');&#60;/p&#62;
&#60;p&#62;% plot the volume rate of heat deposition&#60;br /&#62;
subplot(2, 3, 2);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, Q * 1e-7);&#60;br /&#62;
h = colorbar;&#60;br /&#62;
xlabel(h, '[kW/cm^2]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Volume Rate Of Heat Deposition');&#60;/p&#62;
&#60;p&#62;% plot the temperature after heating&#60;br /&#62;
subplot(2, 3, 3);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, T1);&#60;br /&#62;
h = colorbar;&#60;br /&#62;
xlabel(h, '[degC]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Temperature After Heating');&#60;/p&#62;
&#60;p&#62;% plot the temperature after cooling&#60;br /&#62;
subplot(2, 3, 4);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, T2);&#60;br /&#62;
h = colorbar;&#60;br /&#62;
xlabel(h, '[degC]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Temperature After Cooling');&#60;/p&#62;
&#60;p&#62;% plot thermal dose&#60;br /&#62;
subplot(2, 3, 5);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, kdiff.cem43, [0, 1000]);&#60;br /&#62;
h = colorbar;&#60;br /&#62;
xlabel(h, '[CEM43]');&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Thermal Dose');&#60;/p&#62;
&#60;p&#62;% plot lesion map&#60;br /&#62;
subplot(2, 3, 6);&#60;br /&#62;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, kdiff.lesion_map, [0, 1]);&#60;br /&#62;
colorbar;&#60;br /&#62;
ylabel('x-position [mm]');&#60;br /&#62;
xlabel('y-position [mm]');&#60;br /&#62;
axis image;&#60;br /&#62;
title('Ablated Tissue');&#60;/p&#62;
&#60;p&#62;% set colormap and enlarge figure window&#60;br /&#62;
colormap(jet(256));&#60;br /&#62;
scaleFig(1.5, 1);
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
