Javascript Array Reduce Initial Value Problem Matlab Subplot Feature