function r = chkevod(val,chk) % this function checks if a given number is even or odd. % the command rem is an inbuilt matlab command that accepts two arguments and divides the 1st argument by the second % and its output is the remainder after the division. here the argument chk has value 2, therefore when a number is % divided by 2, the remainder will be 0 or 1 if the number is even or odd respectively. r = rem(val,chk) % function ends, returns r.