Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT Write an M-file

ID: 3935273 • Letter: U

Question

USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT

Write an M-file.- Write a Function.

Write a function that will accept two single ASCII characters and return a string message. The message the function returns will be based on the following:

If the first character is greater than the second, the function will return the message ‘First greater than second’.

If the first character is less that the second, the function will return the message ‘First less than second’.

If the characters are equal, the function will return the message ‘First equal to second’.

Explanation / Answer

function msg=asciiChar(a,b)

numa=double(a)

numb=double(b)

if(numa>numb)

msg="first is greater than second"

end

if(numa<numb)

msg="first is less than second"

end

if(numa==numb)

msg="first and second are equal"

end

end