Académique Documents
Professionnel Documents
Culture Documents
Sheet(3)
Matlab
2015 2016
Sheet ( 3 )
(1)
What is the output on the screen and the result of each of the following:
a) >> a = 1+2+3+4+5+6
b) >> b = 1+2+3+4+5+6;
c) >> b+3
d) >> 1+2+3+4+5+6
e) >> c = 10*ans
(2)
Calculate the following expressions in MATLAB:
a)
b)
c)
d)
(3)
Give the variable
a)
b)
c)
d)
e)
f)
the value 2. In MATLAB enter the following expressions and calculate them.
(4)
Make a row vector with:
Initial value: -1
Final value: 9
Step size: 0.5
(5)
Make a row vector with:
Initial value: 9
Final value: 0
Step size: -1
(6)
Give an one line command that, for an array
b)
a = 1:10
c)
a = 10*rand(6,6)
(7)
Plot the functions sin(t) and cos(t) on the interval [0,2] in one figure.
(8)
Plot the function f below on the interval [-2,3] .
(9)
a) Write the matrix x in matlab where
x= 1 2 3
5 1 4
3 2 -1
b) Find the transpose of x.
c) What is the output of
i) >> x(4)
ii) >> x(2,3)
iii) >> x(1,:)
iv) >> x(:,2)
(10)
Write in matlab
A=
1 2 3
5 1 4
3 2 -1
B=
1
5
3
2 3
1 4
2 -1