In the following table. A, B, and E are variables whose valu es are eithe r o or 1. The val ue of varia ble Z can
be O, 1,2, 3, or4. The value that is assigned to Z depends on A, B, and L2
Wri te MATLAB code that tests the val ues of A, B, and Eand then perform S a selection to assign the correct
value to z. In other words, your code should produce the same results as the table.
You may use if, if-else, or if-elseif. Nesting is allow ed. Write the selec tion only; no printing is needed.
Problem #2 (10 points)
a) What is the output that is displaye
for n = 3:4
3/4d 3/4d\n', m, n. m *n)
b) Convert the nested for loop from Part (a) to its equivalent nested while loop.
Write your own MATLAB function named count TJunct that meets the followingp ec ficaions
'he input argument is a string (i.e., a vector that contains character values).
Usea for loop inside the function to access the vector elements (i.e., the characters):
Count the number of punctuation characters are in the strin
Return these two output arguments:
Number of punctuations in the string
What fraction (in decimal notation) of the total characters were punctuations
the input string is 'Long live, Portland l', there are a tota) of20 characters (spaces and punctuation are
included). The function should return 2 and 0.1 (i.e., 2/20).
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
prompt1='Enter the value of A\n';
prompt2='Enter the value of B\n';
prompt3='Enter the value of E\n';