I was trying to run the example code given in Field-II simulation here on Pulse wave (pw) phantom example. One of the code in the folder which displays the final phantom with pw signal doesn't display the image given in the example. Has anybody got that working. The simulation involves creating scatters , saving the rf- and scatters data , creating phanto and finally simulate pulsing and echo receving with Field-II build in library. I mange to run and save most of the required data and even got some disaply - but not the last , finaly output - tall the files and the output are discussed and given here I try to go through it and fix - but somethig I couldnt figure out what went wrong ...sorry to put it not in a specific way , but I nearly dont know which part caused the issue and unable to narrow down my issue , that is why i share external link for those familari with to helo out the files sonogram.m is the one that doesnt display the final output--- I appreciate if anybody can share tip and thanks, below is the code for sonogram but since it also depends on other file refereed in the link - I make the display part of the code bold for easier referrence
% Program to take audio data and convert it into a sonogram - ultrasound
% image
%
% Version 3, 23/10-96, by JAJ, after version by Henrik Klebaek
% Find the number of samples
lines=max(size('audio.mat'));
lines
% Set parameters for calculating the sonogram
dN=floor(lines/1000+0.5); % Number of new samples for spectrum
Ndft=256; % Samples in one spectrum
Nspec=floor((lines-Ndft)/dN); % Number of spectra
f0=2e6; % Transducer center frequency
fprf=5e3; % Pulse repetition frequency
disp('dN ...')
dN
disp('Nspec')
Nspec
% Initialize data structure
power_dft=zeros(Ndft,Nspec);
power_min=[];
power_max=[];
disp('Making spectrum...')
for i=1:Nspec
if (rem(i,50)==0)
i
end
sig=( audio((i-1)*dN+(1:Ndft)) )';
sig=sig.*hanning(Ndft);
dft=fftshift(abs(fft(sig)).^2); %% FFT transform to separate signals
power_dft(:,i)= dft;
end
% Scale power density
power_min=min(min(power_dft));
power_max=max(max(power_dft));
scale=128./(power_max-power_min);
power_dft=(power_dft-power_min).*scale;
power_dft=log(power_dft+0.005);
power_min=min(min(power_dft));
power_max=max(max(power_dft));
scale=128./(power_max-power_min);
power_dft=(power_dft-power_min).*scale;
% Cut everything below a threshold
%power_dft = (power_dft>5) .* power_dft;
% Make frequency axis
f=fprf/Ndft*((Ndft/2):-1:-(Ndft/2-1));
tidsakse=(1:Nspec)*dN/fprf;
% Make the figure
**figure(1);
image(tidsakse,f/1000,power_dft(Ndft:-1:1,:)); % Sonogram-plot**
%map=gray(128);
%colormap(map(128:-1:1,:))
%brighten(0.2)
%colorbar
brighten(1.0)
%plot(real(data(125,:)))
title('Sonogram');
xlabel('Time [s]');
ylabel('Frequency [kHz]');
%axis([0, max(tidsakse), -2.5, 2.5]) % AXIS([XMIN XMAX YMIN YMAX])
%axis([0, 2.5, -2.5, 2.5]) % AXIS([XMIN XMAX YMIN YMAX])
print -deps sonogram.eps