function bad_subfunction_fun x = 5; % Variable used or defined in outer function are not available to % subfunctions. z = subfun1; function y = subfun1 y = x^2 + 1; % variables are not shared with outermost function % no end statement required