Use the Programming Language —- > MATLAB <—
Write a switch statement that checks origLetter. If origLetter is ‘a’ or ‘A’, assign greekLetter with ‘Alpha’. If origLetter is ‘b’ or ‘B’ assign greekLetter with ‘Beta’. For any other character, assign greekLetter with ‘Unknown Your Function Save CReset E MATLAB Documentation 1 function greekLetter convertAl phabet (origLetter) % Complete the switch statement to assign greekSymbol with “Alpha”, % ‘Beta’, or ‘Unknown’ based on origLetter 4 5Switch origLetter) case ‘a” greekLetterAlpha; otherwise 8 9 10 greekletter = ‘Unknown’; 12 end Code to call your function C Reset ConvertAlphabet(‘a) Code to execute the function when you click Run Run Function Assessment Submit Check if ConvertAlphabet(‘a’) returns Alpha
Expert Answer
Matlab code:
function greekLetter = ConvertAlphabet(origLetter)
switch origLetter
case ‘a’
greekLetter = ‘Alpha’;
case ‘A’
greekLetter = ‘Alpha’;
case ‘b’
greekLetter = ‘beta’;
case ‘B’
greekLetter = ‘beta’;
otherwise
greekLetter = ‘unknown’;
end
end
ConvertAlphabet(‘a’)
ConvertAlphabet(‘A’)
ConvertAlphabet(‘b’)
ConvertAlphabet(‘B’)
ConvertAlphabet(‘x’)
Output screenshot: