0% found this document useful (0 votes)
71 views11 pages

Group 2 Act 3

This document outlines activities for Group 2 of an EEP311L class. It includes: 1) A MATLAB function to check the inverse of a random matrix. 2) Writing systems of equations as augmented matrices and solving them using Gaussian elimination. 3) A MATLAB function and script to solve random systems and check the residual, plotting the results. 4) Solving symbolic and numerical systems to compare the information provided.

Uploaded by

Yamburger Love
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views11 pages

Group 2 Act 3

This document outlines activities for Group 2 of an EEP311L class. It includes: 1) A MATLAB function to check the inverse of a random matrix. 2) Writing systems of equations as augmented matrices and solving them using Gaussian elimination. 3) A MATLAB function and script to solve random systems and check the residual, plotting the results. 4) Solving symbolic and numerical systems to compare the information provided.

Uploaded by

Yamburger Love
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

GROUP 2 EEP311L

ACTIVITY 3

GROUP 2

MEMBERS: SHAIRA PEREZ


EDRICK MICHAEL PANGAN
ERIC MATTHEW FABIAN
JOHN NATHANIEL MAGLAYA
SHERWIN JAIME
NEIL STEPHEN MALONZO
MARK JUSTINE MENDOZA
GROUP 2 EEP311L
ACTIVITY 3

1. Write a well-commented Matlab function program myinvcheck that a. makes a n × n random


matrix (normally distributed, A = randn (n, n)), b. calculates its inverse (B = inv(A)), c. multiplies
the two back together, d. calculates the residual (difference between AB and eye(n)), and e.
returns the scalar residual (norm of the difference). Turn in your program.

To check input this to command window


GROUP 2 EEP311L
ACTIVITY 3

Results:
GROUP 2 EEP311L
ACTIVITY 3

2. Write each system of equations as an augmented matrix, then find the solutions using
Gaussian elimination and back substitution (i.e. the exact algorithm in this chapter).
a. 𝑥1 + 𝑥2 = 2, 4𝑥1 + 5𝑥2 = 10
GROUP 2 EEP311L
ACTIVITY 3

2. Write each system of equations as an augmented matrix, then find the solutions using
Gaussian elimination and back substitution (i.e. the exact algorithm in this chapter)

b. 𝑥1 + 2𝑥2 + 3𝑥3 = −1, 4𝑥1 + 7𝑥2 + 14𝑥3 = 3, 𝑥1 + 4𝑥2 + 4𝑥3 = 1


GROUP 2 EEP311L
ACTIVITY 3

3. Turn in the plot and the two programs. (Do not print any large random matrices.)

a. Write a well-commented Matlab function program mysolvecheck with input a number n that makes a
random n × n matrix A and a random vector b, solves the linear system Ax = b, calculates the scalar
residual r = kAx − bk, and outputs that number as r.
GROUP 2 EEP311L
ACTIVITY 3

3. Turn in the plot and the two programs. (Do not print any large random matrices.)

b. Write a well-commented Matlab script program that calls mysolvecheck 10 times each for n = 5, 10,
20, 40, 80, and 160, then records and averages the results and makes a log-log plot of the average r vs.
n. =

nValues = [5,10,20,40,80,160]
GROUP 2 EEP311L
ACTIVITY 3

nValues = [5,10,20,40,80,160,320,640,1280,2560]
GROUP 2 EEP311L
ACTIVITY 3

4. To see how to solve linear systems symbolically, try

>> B = [sin(sym(1)) sin(sym(2)); sin(sym(3)) sin(sym(4))]

>> c = [1; 2]

>> x = B \ c

>> pretty (x)

Now input the matrix 𝐶𝑠 = [ 1 2 2 4]

symbolically as above by wrapping each number in sym. Create a numerical version via Cn = double(Cs)
and define the two vectors d1 = [4; 8] and d2 = [1; 1]. Solve the systems (as in the third line of code
above) Cs*x = d1, Cn*x = d1, Cs*x = d2, and Cn*x = d2. Explain the results. Does the symbolic or non-
symbolic way give more information?
GROUP 2 EEP311L
ACTIVITY 3

Results:
GROUP 2 EEP311L
ACTIVITY 3

You might also like