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

Help Tell me what you want to do Review View ences Mailings A A Aa 1 Normal 1No

ID: 2259823 • Letter: H

Question

Help Tell me what you want to do Review View ences Mailings A A Aa 1 Normal 1No Spac... H Paragraph Create a vector that starts at a, ends at b, and has a spacing of c. Allow the user to input all of these parameters. Create an M-file that prompts the user to enter a matrix and then use the max function to determine the largest value entered. Use the following matrix to test your program: 3. 12 pts] t1. 5, 3, 8. 9. 22] Use two separate input statements to prompt a user to enter his or her 4. 13 first and last names. Use the disp function to display those names orn pts) one line. (You'll need to combine the names and some spaces into an array.) Prompt the user to enter his or her age. Then use the disp function to report the age back to the command window. If, for example, the user enters 5 when prompted for her age, your display should read pts] Your age is 5 This output requires combining both character data (a string) and numeric data in the disp function-which can be accomplished by using the num2str function. Prompt the user to enter an array of numbers. Use the length function to determine how many values were entered, and use the disp function to report your results to the command window. 6. [3 pts) Before calculators were readily available (about 1974), students used tables to determine the values of mathematical functions like sine, cosine, and log. Create such a table for sine, using the following steps: eate a vector of angle values from 0 to 2 in increments of /10 Calculate the sine of each of the angles, and group your results into a [4 . Cr .

Explanation / Answer

Question-1 Code:

close all
clear
clc

a = input('Enter a: ');
b = input('Enter b: ');
c = input('Enter c: ');
x = a:c:b;
disp('Vector:');
disp(x);

Sample Output

Enter a: 2
Enter b: 10
Enter c: 2
Vector:
2 4 6 8 10

Question-2 Code:

close all
clear
clc

A = input('Enter a matrix: ');
disp('Max element:');
disp(max(max(A)));

Sample Output

Enter a matrix: [1, 5, 3, 8, 9, 22]
Max element:
22

Question-3 Code:

close all
clear
clc

first = input('Enter first name: ', 's');
last = input('Enter last name: ', 's');
disp([first, ' ', last]);

Sample Output

Enter first name: sherlock
Enter last name: holmes
sherlock holmes

Question-4 Code:

close all
clear
clc

age = input('Enter your age: ');
disp(['Your age is ', num2str(age)]);

Sample Output

Enter your age: 5
Your age is 5