function parForDemo
    % check for parallel computing toolbox
    supportsParallel=false;
    try
        sizePool=matlabpool('size');
        supportsParallel=true;
        if sizePool==0
            disp('Warning:  It looks like your computer has the parallel computing')
            disp('toolbox, but no parallel pool is available.  Type ''matlabpool''')
            disp('to start a pool to enable faster basin of attractions calculations');
        end
    catch
    end
    
    % setup for the calculation
    x=linspace(0,5);
    y=zeros(length(x),3);
    
    % the calculation.
    if supportsParallel
        parfor i=1:3
            disp(i);
            y(:,i)=x.^i; 
        end
    else
        for i=1:3
            disp(i);
            y(:,i)=x.^i; 
        end
    end
    plot(x, y(:,1), 'red', x, y(:,2), 'blue', x, y(:,3), 'black');
    title('Comparison of growth rates');
    legend('linear', 'quadratic', 'cubic');
    xlabel('x');
    ylabel('y');
    ylim([0 50]);  % set the y-range

end