tutorial Matlab
tutorial Matlab
Exercise 1
a) Use Matlab to evaluate
3 9 3 9 11 8 7 1.25
5 ; 43 ; 5 ; 5 3 ; 9
4 5 4 2 3 14 3
Page 1 of 4
Exercise 3
Complete the table
Number Mantissa-exponent MATLAB form
789.34
1 10 4
4
4e11
Exercise 4
a- Write 3432.6 in exponent-mantissa form and write 100 1010 in normal form
x cos x
b- Construct the function y x sin 2 for values of x from one to three in steps
x 3x 1
0.02.
c- Plot the quadratic x 2 7 x 3 from x equals -3 to 3 in steps of 0.2
Exercise 5
1) 1: 2 : 3 : 7
2) 1, 2,3, 7
3) 1; 2;3;7
4) 1 237
h-To compute the square of a vector f of data, write:
1) sqr(f)
2) f . 2
3) f 2
4) Square (f)
i- To implement a for loop which ranges over 1 x 5 in increments of 0.5 the best command is:
1- for i=1, 5, 0.5
2- for i=1:0.5:5
3- for loop i=1, 5, 0.5
4- loop i=1:0.5:5 do
j- A function y e 2 x is defined numerically for some data range x. It can be entered using:
1) y exp x exp x
2) y sqr exp x
3) y exp x . exp x
4) y sqrt exp x
k- To find the largest value in a column vector x, type:
1) max(x)
2) maximum (x)
3) largest (x)
l- To plot a log-log plot, the correct command is:
1) Plot (x, y, ‘log-log’)
2) loglog (x, y)
3) log (x, y)
Page 3 of 4
4) logplot (x, y)
Exercise 6
1- Find the inverse of the matrix:
1 2
A
2 1
2- By calculating the matrix inverse of the coefficient matrix, solve the system:
x 2y 4
3x 4 y 7
3- Find the rank of the matrix:
1 2 4
3 2 5
1 2 8
4- Find the inverse of the matrix in the previous problem.
Page 4 of 4