echo on
clear all
Mass = rand(5,10000);
Length = rand(5,10000);
Width = rand(5,10000);
Height = rand(5,10000);

[rows, cols] = size(Mass);

echo off

disp([char(10), 'Using Array Operations:'])
tic
Density_vec = Mass./(Length.*Width.*Height);
toc

disp([char(10), 'Using Loops:'])
tic;
for I = 1:rows
   for J = 1:cols
      Density_loop(I,J) = Mass(I,J)/(Length(I,J)*Width(I,J)*Height(I,J));
   end
end
toc


