fs=100e6;                 %  Sampling frequency [Hz]
c=1540;                   %  Speed of sound [m/s]
no_lines=50;              %  Number of lines in image
image_width=40/1000;      %  Size of image sector
d_x=image_width/no_lines; %  Increment for image

%%  Read the data and adjust it in time 

min_sample=0;
for i=1:no_lines

  %  Load the result
  cmd=['load rf_data/rf_ln',num2str(i),'.mat'];
  eval(cmd)
  
  % Pad the rf_data line with zeros and
  %  Find the envelope 
  rf_env = ...
  
  % Store the envelope
  env(1:max(size(rf_env)),i) = rf_env;
end

%%  Do logarithmic compression
D=5;   %  Sampling frequency decimation factor


%  Create the image

% xlabel('Lateral distance [mm]')
% ylabel('Axial distance [mm]')
% colormap(gray(255))