QuestionQuestion

Transcribed TextTranscribed Text

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. Test these Assign this A B E Z 1 1 1 1 1 4 1 1 3 1 1 2 1 1 1 1 Problem #2 (10 points) a) What is the output that is displaye estedfor loop? form= 1:2 for n = 3:4 3/4d 3/4d\n', m, n. m *n) end end 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 Example: If 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).

Solution PreviewSolution Preview

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';
A=input(prompt1);
prompt2='Enter the value of B\n';
B=input(prompt2);
prompt3='Enter the value of E\n';
E=input(prompt3);

if E==1
    if B==0
       if A==0
            Z=4
       elseif A==1
            Z...
$28.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available MATLAB for Engineering Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats