1. Evaluate the following matrices. Check your answers using MATLAB.
Use the following matrix G where referenced.
0.6 1.5 2.3 -0.5
8.2 0.5 -0.1 -2.0
G: 5.7 8.2 9.0 1.5
0.5 0.5 2.4 0.5
1.2 -2.3 -4.5 0.5
a.)A= G(:,2);
b.) B: G(4,:);
c.) C=[10:15];
d.) D=[4:9;1:6];
6²) E=[‘525];
f.) F: [0.0 : 0.1 :1.0];
g.) T1=G(4:5,1:3);
h.) T2=G(1:2:5,:);
2. Evaluate the following expressions. Check your answers using MATLAB.
a.) round( -2.6)
b.) fix( -2.6)
c.) floor ( 2.6)
d.) ceil (-2.6)
e.) sign (-2.6)
f.) abs(round( -2.6
g.) sqrt(floor( 10.7))
h.) rem( 15 , 2)
1²) floor(ceil( 10.8))
j.) log10( 100) + log10( 0.001)
k.) abs( -5 : 5
l.) round([0:0.3:2, 1:0.75:4])
3. Give MATLAB statements that could perform the steps indicated (pseudo code). Assume that
the variables are scalars.
a.) If time is greater than 50.0, increment time by 1.0.
b.) When the square root of poly is less than 0.001, print the value of poly.
c.) If the difference between volt_1 and volt_2 is larger than 2.0, print the values of volt_1 and
volt_2.
d.) If the value of den is less than 0.003, set result to zero; otherwise, set result equal to num
divided by den.
e.) If the natural logarithm of x is greater than or equal to 10, set time equal to zero and
increment count by 1.
f.) If dist is less than 50.0 and time is greater than 10.0, increment time by 2; otherwise,
increment time by 5.
g.) If dist is greater than or equal to 100.0, increment time by 10. If dist is between 50 and 100,
increment time by 1. Otherwise, increment time by 0.5.
4. Evaluate the following expressions. Check your answers using MATMB.
Use the following matrices w, x, and y where referenced.
w = [ 0 3 -2 7
x = [3 -1 5 7]
1 3 7
y = 2 8 4
6 -1 -2
a.) max( w)
b-) min( Y)
c.) min( w, x)
d.) [z.i1=max(y)
e.) mean( y)
f.) median ( w
3-) cumprod( 3/)
h.) sum( x
i.) sort( 2xw+x
i-) 8oM y)