Javascript Math Max Function Matlab