Write a MATLAB program to ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. If the user enters a 5 x 1 vector, use a warning statement to inform the user of their error, and set the new input value to be the transpose of the user input value. If the user enters a vector that is not the correct size or a 5 x 1 vector, ask the user to reenter the vector using the correct dimensions. The program should continuously check the user input each time it is entered. Continue to ask the user to input a new vector until the user has entered three tries. If the user fails to enter a vector correctly given three chances (including the first entry), use an error message to terminate the program. If the user enters a correct vector, or the vector is transposed, the program should restate the result for the user. Your ouput should match the following example's formatting exactly.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Matlab problem

ICA 19 - 15
Write a MATLAB program to ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. If the user enters a 5 x 1 vector, use a warning statement to
inform the user of their error, and set the new input value to be the transpose of the user input value. If the user enters a vector that is not the correct size or a 5 x 1 vector, ask
the user to reenter the vector using the correct dimensions. The program should continuously check the user input each time it is entered. Continue to ask the user to input a new
vector until the user has entered three tries. If the user fails to enter a vector correctly given three chances (including the first entry), use an error message to terminate the
program. If the user enters a correct vector, or the vector is transposed, the program should restate the result for the user. Your ouput should match the following example's
formatting exactly.
The resulting 1 x 5 vector is:
1 2 3 4 5
Output formatting:
■ The sentence is on the first line.
▪ The numbers are on the next line.
▪ The numbers are shown with no decimal places.
▪ The numbers are separated by a single space.
Note: Because MATLAB Grader cannot accept user input, call the script "Generate_UserInput_V" anywhere you would ask the user to input a vector, like in line 14 of the provided
template. The "Generate_UserInput_V" script effectively replaces the following line of code:
V input('Enter a 1 x 5 vector: ');
Script
My Solutions >
Save C Reset
11% Program
12% Start writing your program here
MATLAB Documentation
1% Variables to be used
2% Inputs
3 % V – vector entered by user
4% Note: because MATLAB Grader cannot accept user input, call the script "Generate_UserInput_V" anywhere you would ask the user to inp
5 % like in line 14. The "Generate_UserInput_V" script effectively replaces the following line of code:
6 % V = input('Enter a 1 x 5 vector: ');
7
8% Outputs
9 % V vector entered by user (corrected if entered transposed)
10
13
14 Generate_UserInput_V% In MATLAB Grader use this line in place of asking the user to enter a vector. This generates a variable V, as
15
Transcribed Image Text:ICA 19 - 15 Write a MATLAB program to ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. If the user enters a 5 x 1 vector, use a warning statement to inform the user of their error, and set the new input value to be the transpose of the user input value. If the user enters a vector that is not the correct size or a 5 x 1 vector, ask the user to reenter the vector using the correct dimensions. The program should continuously check the user input each time it is entered. Continue to ask the user to input a new vector until the user has entered three tries. If the user fails to enter a vector correctly given three chances (including the first entry), use an error message to terminate the program. If the user enters a correct vector, or the vector is transposed, the program should restate the result for the user. Your ouput should match the following example's formatting exactly. The resulting 1 x 5 vector is: 1 2 3 4 5 Output formatting: ■ The sentence is on the first line. ▪ The numbers are on the next line. ▪ The numbers are shown with no decimal places. ▪ The numbers are separated by a single space. Note: Because MATLAB Grader cannot accept user input, call the script "Generate_UserInput_V" anywhere you would ask the user to input a vector, like in line 14 of the provided template. The "Generate_UserInput_V" script effectively replaces the following line of code: V input('Enter a 1 x 5 vector: '); Script My Solutions > Save C Reset 11% Program 12% Start writing your program here MATLAB Documentation 1% Variables to be used 2% Inputs 3 % V – vector entered by user 4% Note: because MATLAB Grader cannot accept user input, call the script "Generate_UserInput_V" anywhere you would ask the user to inp 5 % like in line 14. The "Generate_UserInput_V" script effectively replaces the following line of code: 6 % V = input('Enter a 1 x 5 vector: '); 7 8% Outputs 9 % V vector entered by user (corrected if entered transposed) 10 13 14 Generate_UserInput_V% In MATLAB Grader use this line in place of asking the user to enter a vector. This generates a variable V, as 15
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY