Download Analysis of Image Intensity Stabilization with Different REV Sizes using MATLAB - Prof. Hu and more Assignments Biology in PDF only on Docsity! ENBE 643 Fall 2004 Homework Exercise #1: KEY The MATLAB code used to perform the analysis is given below. The results are illustrated in the following figure: The mean image intensity (0.462) and the standard deviation of image intensities (0.498) have essentially stabilized with a relatively small REV size of 20 angstroms. However there is still some variation of these estimates between REVs at the 20 angstrom size. The standard deviation plots suggest that an appropriate REV size would be at least 50 angstroms but 75 angstroms (or more) is better for this material. MATLAB Code: format compact % % load-up the binary image stored in file silicium.mat % then get its number of rows and columns % load silicium [nrow, ncol] = size(sivb); pixsize = 0.6; % pixel size in angstroms % REVsizes = [1 2 5 10 20 50 75 100]; % define REV sizes to use REVpix = round(REVsizes/pixsize);% define corresponding number of pixels for REVs % % Initialize variables % mean_of_mean = []; stdv_of_mean = []; mean_of_stdv = []; stdv_of_stdv = []; num_of_samples = 1000; % % Loop over REV sizes % for tilesize = REVpix tilesize % % choose random sample positions: upper left corners of REVs % i = round(rand(num_of_samples,1)*(nrow-tilesize)+1); j = round(rand(num_of_samples,1)*(ncol-tilesize)+1); % % initialize values of sample stats % means = []; stdv = []; % % Calculate stats for each REV % for the_sample = 1:num_of_samples % extract sub-image sample = sivb(i(the_sample)+[0:tilesize-1],j(the_sample)+[0:tilesize-1]); % calculate stats sample_mean = mean(sample(:)); sample_stdv = std(sample(:),1); % store values means = [means ; sample_mean]; stdv = [stdv ; sample_stdv]; end % % Calculate stats of REV means and standard deviations % mean_REV_mean = mean(means); stdv_REV_mean = std(means,1); mean_REV_stdv = mean(stdv); stdv_REV_stdv = std(stdv,1); % % Store those results % mean_of_mean = [mean_of_mean ; mean_REV_mean]; stdv_of_mean = [stdv_of_mean ; stdv_REV_mean]; mean_of_stdv = [mean_of_stdv ; mean_REV_stdv]; stdv_of_stdv = [stdv_of_stdv ; stdv_REV_stdv]; end % % Plot results % subplot(2,2,1)