
Math 477/577 โ Computer Assignment 1
1. Set up a 4 ร4 matrix, and use the function sum to find the sums of the first row and second
column of the matrix.
2. Solve the following system of equations using Matlab:
2x+y+ 5z= 5
2x+ 2y+ 3z= 7
x+ 3y+ 3z= 6 .
Verify your solution by matrix multiplication.
3. Write a simple script to input two square matrices Aand B. Then add, subtract and multiply
them. Comment the script and use disp to output suitable titles.
4. Write a Matlab script to produce graphs of the functions y= cos xand y= cos(x3) in the range
x=โ4 : 0.02 : 4 using the same axes. Use the Matlab functions xlabel,ylabel and title to
annotate your graphs clearly.
5. Write a function col sum that generates a random square matrix Aof specified size n, and then
finds the sums of each of the columns using
(a) for-loops,
(b) the function sum.
Include a timing comparison. Test the function with n= 10,100,1000.