Question

In: Computer Science

Given the following two matrices: Matrix A that contains the marks of the college of engineering...

  1. Given the following two matrices:
  • Matrix A that contains the marks of the college of engineering students (250 Student) in 12 courses
  • Matrix B that contains the number of credit hours of each course.

Write a Matlab code to

  1. Print the letter grades (A to D) of student if you are given his ID and the course number from 1 to 12
  2. Print his GPA in this semester.

Gpa=sum(mark in subject i * subiect credit i) /total number of credit,
i=1:12

Solutions

Expert Solution

MATLAB:


clc;close all;clear all;
A = randi([10,100],250,12);
B = randi([2,6],1,12);
i=input('Enter student id:?');
j=input('Enter course number:?');
%TO define grades

if A(i,j)>= 91 && A(i,j)>=100
grade='A';
elseif A(i,j) >= 81 && A(i,j)>=90
grade='B';
elseif A(i,j) >= 71 && A(i,j)>=80
grade='C';
elseif A(i,j) >= 61 && A(i,j)>=70
grade='D';
elseif A(i,j) <61
grade='F';
end
fprintf('The grade of the student in the subject is %c\n',grade);
%To calculate GPA of the semester
for j=1:1:12
Gpa=Gpa+(A(i,j) * B(j) );
endfor
Gpa=Gpa/(10*sum(B));
fprintf('The GPA of the student in this semester is %3.2f\n',Gpa);

Command window:

Enter student id:?100
Enter course number:?10
The grade of the student in the subject is F
The GPA of the student in this semester is 5.14

Enter student id:?200
Enter course number:?12
The grade of the student in the subject is F
The GPA of the student in this semester is 6.84

Enter student id:?150
Enter course number:?11
The grade of the student in the subject is F
The GPA of the student in this semester is 4.97


Related Solutions

For the following matrices, first find a basis for the column space of the matrix. Then...
For the following matrices, first find a basis for the column space of the matrix. Then use the Gram-Schmidt process to find an orthogonal basis for the column space. Finally, scale the vectors of the orthogonal basis to find an orthonormal basis for the column space. (a) [1 1 1, 1 0 2, 3 1 0, 0 0 4 ] b) [?1 6 6, 3 ?8 3, 1 ?2 6, 1 ?4 ?3 ]
What is the difference between multiplying a matrix times a vector and multiplying two matrices?
What is the difference between multiplying a matrix times a vector and multiplying two matrices?
BCG growth matrix , Ansoff matrix and resource based variables Many tools, such as various matrices,...
BCG growth matrix , Ansoff matrix and resource based variables Many tools, such as various matrices, can be used by a company performing strategic analysis. Pick any three tools and briefly describe each and explain when a company could use them. What are their limitations? Use examples to illustrate the use of your three chosen tools. Critically analyse and elaborate
For matrices, a mulitplicative identity is a square matrix X such XA = AX = A...
For matrices, a mulitplicative identity is a square matrix X such XA = AX = A for any square matrix A. Prove that X must be the identity matrix. Prove that for any invertible matrix A, the inverse matrix must be unique. Hint: Assume that there are two inverses and then show that they much in fact be the same matrix. Prove Theorem which shows that Gauss-Jordan Elimination produces the inverse matrix for any invertible matrix A. Your proof cannot...
Given below is a correlation matrix from a study of drinking habits of college students.  The purpose...
Given below is a correlation matrix from a study of drinking habits of college students.  The purpose of the study is to examine what affects the amount of alcohol consumed by students. Consumption (C) has been measured as the amount of alcohol consumed per week.  Sports (S) refers to the amount of time spent by the student on sports and athletics activities per week. Consumption (H) at home refers to the amount of alcohol consumed by the student’s family at home per...
Given the following Matrices: Briefly discuss the importance of studying mathematical economics
Given the following Matrices: Briefly discuss the importance of studying mathematical economics
Given the matrix A (2x2 matrix taking the first two column vectors from the input file),...
Given the matrix A (2x2 matrix taking the first two column vectors from the input file), compute the followings. Λ: the diagonal matrix whose diagonal elements are the corresponding eignevalues Λii = λi for i=1,2 R: the 2x2 matrix whose ith column vector is the eigenvector corresponding to λi for i=1,2 RΛRT: the matrix compositions 1/0: the comparison between A and RΛRT (is A= RΛRT?) Your output should have seven lines where the first two lines correspond to the 2x2...
1. Discuss the different properties of Matrices for each matrix 2. What is the importance of...
1. Discuss the different properties of Matrices for each matrix 2. What is the importance of interface in fiber reinforce composite?
Recall the Matrix Chain Multiplication Algorithm for determining the optimal parenthesization for a product of matrices....
Recall the Matrix Chain Multiplication Algorithm for determining the optimal parenthesization for a product of matrices. Provide a recursive implementation of the function void print_parenth(Matrix K[], int i, int j); that takes as input the matrix K of k values that are needed to construct the optimal parenthesization for Ai · · · Aj . Assume access to a print function that takes as input a string and prints its value. You may also assume a “+” operation for string...
generate the following matrices with given rank and verify with the rank command. Include the Matlab...
generate the following matrices with given rank and verify with the rank command. Include the Matlab sessions in your report as indicated. A) is 8x8 with rank 3. B) is 6x9 with rank 4. C) is 10x7 with rank 5 .
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT