Perfect Square Function In Matlab