0% found this document useful (0 votes)
24 views2 pages

Lab 07 Matrices: All Scripts Should Be Stored in Your Firstlastname Folder and Have Clear Names

This document provides instructions and examples for several matrix and array operations in MATLAB: 1) Generate a 7x3 matrix and write expressions to access specific elements and rows. 2) Write a program to count even and odd elements in an array. 3) Split an array into three arrays based on element value ranges. 4) Write programs to calculate the sum of elements in each column and row of a matrix. 5) Write a program to convert student grade arrays to alphanumeric grade arrays using a function. 6) Write a program to count the number of students receiving each letter grade from a student grades array.

Uploaded by

Bishoy Emile
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Lab 07 Matrices: All Scripts Should Be Stored in Your Firstlastname Folder and Have Clear Names

This document provides instructions and examples for several matrix and array operations in MATLAB: 1) Generate a 7x3 matrix and write expressions to access specific elements and rows. 2) Write a program to count even and odd elements in an array. 3) Split an array into three arrays based on element value ranges. 4) Write programs to calculate the sum of elements in each column and row of a matrix. 5) Write a program to convert student grade arrays to alphanumeric grade arrays using a function. 6) Write a program to count the number of students receiving each letter grade from a student grades array.

Uploaded by

Bishoy Emile
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Cairo University Faculty of Engineering Credit Hour System GENN004

Lab 07 Matrices
________________________________________________________________________ All scripts should be stored in your FirstLastName folder and have clear names 1. Find an efficient way to generate the following matrix: mat = 7 12 8 10 9 8 10 6

Then, give expressions that will, for the matrix mat, refer to the element in the first row, third column refer to the entire second row refer to the first two columns 2. Write a program to count the even and the odd elements in an array. Assuming the array = [1 7 8 2 4 7], the output should be even=2 and odd=3. . 3. Given an array like [2, 8, 3, 30, 4, 50, 100, 200, 4, 80, 500]. I want to split it into three arrays with different ranges: [0-10), [10-100), and [100-1000). The above array should become 2, 8, 3, 4, 4 30, 50, 80 100, 200, 500 How to do this? 4. Find a short MATLAB expression to build the matrix ( )

a- Write a program that calculates the sum of the elements in each column. So your output will be a 1x3 vector like (14 17 24) b- Write a program that calculates the sum of the elements in each row. So your output will be a 3x1 vector like (6; 21 24) 5. Write a program that reads an array of students grades from the user and creates an array of characters containing the corresponding alphanumeric grades. Use a function to do the conversion.

Lab 07

1/2

Cairo University Faculty of Engineering Credit Hour System GENN004

Example: Enter students grades:[98 23 77 88 99 Alphanumeric grades [A F C B A

65 57] D F]

6. Write a program that reads an array of students grades from the user and creates 1x5 array containing the number of A, B, C, D, and F students. Example: Enter students grades:[98 23 77 88 99 Students statistics A B C D F 2 1 1 1 2

65 57]

Lab 07

2/2

You might also like