function [f,g] = makeCubic(b,c)
	% Demonstration of nested functions
    % and scoping

    % Nested function. 
    % Child function can access
    % variables in the parent workspace.
    function y = myCubic(x)
        y = x.^3 + b*x + c;
    end
	f = @myCubic; 
	
    % Anonymous function doing the same thing. 
	g = @(x)(x.^3 + b*x + c); 
    
    % How are the functions affected? 
    % 'f' is changed retroactively, 
    % but 'g' is not. 
	b = NaN; 
    
    % Be careful when working with nested functions! 
   
end