Matlab command that will create a ten-element column vector


1. Given matrix C_4=[2 4 6 8 10;3 6 9 12 15; 7 14 21 28 35]

a. Write one MatLab command that will create a three-element column vector named A_4 that contains the elements of the third column of C_4. Use the disp command to present your final answer.

b. Write one MatLab command that will create a five-element vector named B_4 that contains the elements of the second row of C_4. Use the disp command to present your final answer.

c. Write one MatLab command that will create a nine-element column vector named D_4 that contains the elements of the first, third and fifth columns of C_4. Use the disp command to present your final answer.

d. Write one MatLab command that will create a ten-element column vector named F_4 that contains the elements of the first and second rows of C_4. Use the disp command to present your final answer.

2. The maximum daily temperature (in °F) for New York City and Pittsburgh during the month of January, 2006 are given in the vectors below

TNY=[31 26 30 29 33 33 39 41 41 34 33 45 42 36 39 37 45 43 36 41 37 32 35 42 38 33 40 37 36 51 50] TPITT=[37 24 28 25 21 28 46 37 36 20 24 31 34 40 43 36 34 41 42 35 38 36 35 33 42 40 37 26 20 25 31]

Write a program (script file) to answer the following:

 a) Calculate the average temperature for the month in each city. Use an fprintf command to display the final answer.

 b) Calculate the maximum temperature for the month in each city. Use an fprintf command to display the final answer.

 c) Calculate the minimum temperature for the month in each city. Use an fprintf command to display the final answer.

d) Create a table to display the average, max, min for each city (use the fprintf command to create the table)

City

 

Ave Temperature

 

Max Temperature

 

Min Temperature

 

New York

 

 

 

Pittsburgh

 

 

 

 

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Matlab command that will create a ten-element column vector
Reference No:- TGS01129565

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)