Hi,
I am currently using GNU/Octave with k-wave and wanted to make an animation of some of the simulations I am running. The default way to do this in k-wave isn't supported in octave (or newer versions of matlab) by passing ‘RecordMovie’ as true in kspaceFirstOrder2D(...). Therefore I am looking to capture the pressure field at each point in time and then plot it as a mesh plot.
I was able to do something similar using FOCUS (http://www.egr.msu.edu/~fultras-web/index.php) with the following code (using matlab)...
nt = size(p_tsd, 4); % The amount of time points in the array
for it = 1:nt
mesh(z*100, x*100, squeeze(p_tsd(:, :, :, it)))
title(['FNM TSD Example, t = ', sprintf('%0.3f',(it/fs) * 1e6), '\mu','s'])
zlabel('pressure (Pa)')
xlabel('z (cm)')
ylabel('x (cm)')
temp=axis();
temp(5)=-maxpressure;
temp(6)=maxpressure;
axis(temp);
cb = colorbar();
caxis([-maxpressure maxpressure]);
ylabel(cb, 'Pressure (Pa)');
drawnow
frame = getframe(1);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if it == 1
imwrite(imind,cm,'x-z_transient_bone.gif','gif', 'Loopcount',inf);
else
imwrite(imind,cm,'x-z_transient_bone.gif','gif','WriteMode','append','DelayTime', 0);
end
end
So would something similar be possible in k-wave?