Menu

[Solved] Objectives 1d Arrays Array Functions Accessing Arrays Linear Indexing Logical Indexing Lab Q37268644

Need help on this Matlab assignment

Objectives: 1D arrays and array functions, accessing arrays, linear indexing and logical indexing About the labs: Questions a

Problem 1. (If/elseif Branching) The weather report for Davis city, CA is: w = [54 60 66 75 38 41 44 46 3.94 3.86-2.76-1.18]

Problem 2. (2D Sorting) The following table contains the scores for the 4 students A,B.C and D for four Homeworks HW1 50 20 8

20 30 15 40 Also obtain, using the sort command, the following matrix which contain the indices of the above matrix prior t

Objectives: 1D arrays and array functions, accessing arrays, linear indexing and logical indexing About the labs: Questions and instructions of each lab will be on the Canvas. They will be available at the beginning of each lab. The labs last for 50 minutes. The last 20 minutes will be allocated for the quiz, while the first 30 minutes will be for the mini project. You can talk during the mini project or look up your notes. But during the quiz, you cannot talk or look up your class notes. Students can submit their mini project files within 24 hours. Quizzes must be submitted before the end of the lab period. Part 1: Mini Project Work by yourself or other group members on this project. It’s okay if you don’t finish here but submit what you have as a pdf file on Canvas. If you can’t finish, you can also submit after the lab. Open a new script and work in it. Type your info as comments in the beginning of your script: % First Name: <Your First Name> % Last Name: Your Last Name> % SID: <Your Student ID> Please read: Divide each question into separate sections using the % % operator. Clearly write the answer to each question in a comment, using disp0 or using fprintf0. You should submit a PDF file using publish feature in Matlab. WRITE YOUR CODES IN EDITOR WINDOW Problem 1. (Ifelseif Branching) The weather report for Davis city, CA is: W [54 60 66 75 38 41 44 46 3.94 3.86-2.76-1.18] Problem 1. (If/elseif Branching) The weather report for Davis city, CA is: w = [54 60 66 75 38 41 44 46 3.94 3.86-2.76-1.18] The first four entries are average maximum temperature in °F for Jan, Feb, Mar & Apr, then next four are average minimum temperature in °F for the same months, the next four are average precipitation in inch for those months The data will be assigned to the following variables: w= [maxT, maxT, maxT, max. min , min precipitation, precipitation]. , min , min. precipitation, precipitation, Create a script using if-else to check if there are any errors in the data. a. If any maxT value is greater than 74.6, using dispO display the message “Error in maxT category, please correct maxT data”. b. If any minT is greater than or equal 44, using dispO display the message “Error in minT category, please corrcet mint data”. c. If any precipitation data is negative it is incorrect and needs to be replaced by positive values. Suppose the negative number is -10, then make it 10) Using disp0.display the message “Error in precipitation category, the data is converted into positive value” Problem 2. (2D Sorting) The following table contains the scores for the 4 students A,B.C and D for four Homeworks HW1 50 20 85 65 HW2HW 45 80 30 95 HW4 75 35 15 80 Student A Student B Student C Student D 40 60 100 a) Create a matrix with the above data b) What is the minimum score of all four homework? (use the min function) c) Who is the student with the minimum score over all 4 homework assignments? d) For which homework did the student C got the minimum score e) Calculate the standard deviation and mean of the scores for each homework. f) Calculate the standard deviation and mean of the scores for each student g) Find the minimum score for each exam without using the function min) and create the following output. [20,30,15,40] h) For each exam sort the score in descending order, i.e. from high to low, to obtain the following Matrix 85 95 80 100 65 80 75 60 50 45 35 55 20 30 15 40 Also obtain, using the “sort” command, the following matrix which contain the indices of the above matrix prior to sorting i) obtain the following output using Reshape. 50 85 45 30 75 15 55 60 20 65 80 95 35 80 40 100 To answer the above questions you may need to use the functions sort0. sortrowsO. reshape and Matrix Transpose while. (Use help of Matlab for each function) Show transcribed image text Objectives: 1D arrays and array functions, accessing arrays, linear indexing and logical indexing About the labs: Questions and instructions of each lab will be on the Canvas. They will be available at the beginning of each lab. The labs last for 50 minutes. The last 20 minutes will be allocated for the quiz, while the first 30 minutes will be for the mini project. You can talk during the mini project or look up your notes. But during the quiz, you cannot talk or look up your class notes. Students can submit their mini project files within 24 hours. Quizzes must be submitted before the end of the lab period. Part 1: Mini Project Work by yourself or other group members on this project. It’s okay if you don’t finish here but submit what you have as a pdf file on Canvas. If you can’t finish, you can also submit after the lab. Open a new script and work in it. Type your info as comments in the beginning of your script: % First Name: % Last Name: Your Last Name> % SID: Please read: Divide each question into separate sections using the % % operator. Clearly write the answer to each question in a comment, using disp0 or using fprintf0. You should submit a PDF file using publish feature in Matlab. WRITE YOUR CODES IN EDITOR WINDOW Problem 1. (Ifelseif Branching) The weather report for Davis city, CA is: W [54 60 66 75 38 41 44 46 3.94 3.86-2.76-1.18]
Problem 1. (If/elseif Branching) The weather report for Davis city, CA is: w = [54 60 66 75 38 41 44 46 3.94 3.86-2.76-1.18] The first four entries are average maximum temperature in °F for Jan, Feb, Mar & Apr, then next four are average minimum temperature in °F for the same months, the next four are average precipitation in inch for those months The data will be assigned to the following variables: w= [maxT, maxT, maxT, max. min , min precipitation, precipitation]. , min , min. precipitation, precipitation, Create a script using if-else to check if there are any errors in the data. a. If any maxT value is greater than 74.6, using dispO display the message “Error in maxT category, please correct maxT data”. b. If any minT is greater than or equal 44, using dispO display the message “Error in minT category, please corrcet mint data”. c. If any precipitation data is negative it is incorrect and needs to be replaced by positive values. Suppose the negative number is -10, then make it 10) Using disp0.display the message “Error in precipitation category, the data is converted into positive value”
Problem 2. (2D Sorting) The following table contains the scores for the 4 students A,B.C and D for four Homeworks HW1 50 20 85 65 HW2HW 45 80 30 95 HW4 75 35 15 80 Student A Student B Student C Student D 40 60 100 a) Create a matrix with the above data b) What is the minimum score of all four homework? (use the min function) c) Who is the student with the minimum score over all 4 homework assignments? d) For which homework did the student C got the minimum score e) Calculate the standard deviation and mean of the scores for each homework. f) Calculate the standard deviation and mean of the scores for each student g) Find the minimum score for each exam without using the function min) and create the following output. [20,30,15,40] h) For each exam sort the score in descending order, i.e. from high to low, to obtain the following Matrix 85 95 80 100 65 80 75 60 50 45 35 55
20 30 15 40 Also obtain, using the “sort” command, the following matrix which contain the indices of the above matrix prior to sorting i) obtain the following output using Reshape. 50 85 45 30 75 15 55 60 20 65 80 95 35 80 40 100 To answer the above questions you may need to use the functions sort0. sortrowsO. reshape and Matrix Transpose while. (Use help of Matlab for each function)

Expert Answer


Answer to Objectives: 1D arrays and array functions, accessing arrays, linear indexing and logical indexing About the labs: Questi… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *