Problem Solutions in Lecture 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Answers to the problems in

lecture 2
1. Create a column vector in which the first element is 38.5, the elements decrease with increment of -3.5, and
the last element is 0. what is the number of elements in the created vector?
Create a vector A that has 14 elements of which the first is 49, the increment is -3, and the last term is 10. Then,
using the colon symbol, create a new vector B that has 8 elements. The first four elements are the first four
element of vector A and last four element are the last four element of vector A.
Create two 4 by 3 matrices, one of integers and one of real numbers, such that all its elements lie between 5 and
9.
Note: do not make matrices by giving individual values to the elements. Use the commands for
generating random matrices.
2 1
−3 2 2 2 −2
Given Matrices: A = ,B= 4 0 ,C=
4 0 −1 3 5
11 6
S is the array multiplication of A and D, where D is matrix multiplication of C and B.
Determine the value of S.
2 1 1
Given Matrix H = 6 −2 4
1 −6 1
Find the transpose, inverse and determinant of matrix H.
Create a variable name trig_table which is a trigonometric table where each row
represent a trigonometric function and each column represent an angle. It is a 6 by 5
matrix where the values of trigonometric functions namely sin, cos, tan, cosec, cot, sec
are obtained for angles (in degree) 0, 30, 45, 60, 90.
Given function:
3*sin(x) + 2*log(x), where x is in degrees for sine function and log
is to the base 10
Determine the values of the function at x = 23, 34, 45, 60, 100.
We have created a trigonometric table in the previous topic. Now using character
arrays, make a table, which will contain the name of the function in the first column
and the degrees in the first row.
In the next slide, the final result is given. Using some matlab commands on
previously made trig_table, reach the final result.

You might also like