Code covered by the BSD License  

Highlights from
Multi-Scale Analysis of Area Fractions Characterization GUI

image thumbnail
from Multi-Scale Analysis of Area Fractions Characterization GUI by Mark Tschopp
Characterizes a binary microstructure using the multi-scale analysis of area fractions technique.

fit_MSAAF_curve(L,CV,Af)
function [alpha, xi] = fit_MSAAF_curve(L,CV,Af)

% The function g(x) accepts a matrix of coefficients, x, for a particular
% function
clear x;
g = @(x) sum((log((Af./(1-Af)+x(1).*(L-1).^(-2*x(2))).^(1/2).^(-1))-log(CV)).^2);

% This very quickly iterates to a minimum sum-of-squares (i.e., g) value.
min_fval = 1e9;
min_x = [0, 0];
for i = 1:5
    if i == 1;
        alpha = rand*.1;
        xi = -rand*2;
    else
        alpha = x(1);
        xi = x(2);
    end
    [x,fval] = fminsearch(g,[alpha,xi]);
%    disp(['Fval: ', num2str(fval), ' x: ', num2str(x)])
    if fval < min_fval
        min_x = x;
        min_fval = fval;
    end
end

Contact us at files@mathworks.com