clear format compact % Matrix elements a = 1; b = 2; c = 2; d = 1; % use a function defined in a dedicated file de1 = determ(a, b, c, d) % use local function defined at the bottom of the script de2 = determ2(a, b, c, d) % define anonymous function accepting four arguments determ3 = @(a, b, c, d) a*d - b*c; % define anonymous function accepting two arguments determ4 = @(a, b) a*d - b*c; % cnhange the parameters and compare four functions c = 1; d = 3; de1 = determ(a, b, c, d) de2 = determ2(a, b, c, d) de3 = determ3(a, b, c, d) de4 = determ4(a, b) % local function definition function de = determ2(a, b, c, d) de = a*d - b*c; end