(a) Start up MATLAB. In thecommand window type x = -1:0.1:1 and then execute each of the following statements by typing them in and pressing return:
sqrt(x) cos(x)
sin(x) 2./x
x.\ 3 plot(x, sin(x.^3))
plot(x, cos(x.^4))
Examine the effects of each statement carefully.
(b) Execute the following and explain the results:
x = [2 3 4 5]
y = -1:1:2
x.^y
x.*y
x./y
(a) Set up the matrix A = [1 5 8;84 81 7;12 34 71] in the command window and examine the contents of A(1,1), A(2,1), A(1,2), A(3,3), A(1:2,:), A(:,1), A(3,:), and A(:,2:3). (b) What do the following MATLAB statements produce?
x = 1:1:10
z = rand(10)
y = [z;x]
c = rand(4)
e = [c eye(size(c)); eye(size(c)) ones(size(c))]
d = sqrt(c)
t1 = d *d
t2 = d. *d