1. 
The exercises here show the techniques of logicalindexing (indexing with
01 vectors). Given x = 





a. x(x > 3) 


b. y(x <= 3) 


c. (x > 5) & (x < 8) 


d. x((x < 4)  (x >= 6)) 


e. y((x < 2)  (x >= 8)) 


f. x(y < 0) 




2. 
Given x = [3 14 9 10 2 0 12 9 7 1], provide the command(s) that: 





a. set the values of x, which are positive, to zero 


b. multiply the values of x, which are even numbers, by 4 


c. set values of x, which are multiples of 3, to 3 (command rem may help) 


d. extract the values of x, which are greater than 9, into a vector called y 


e. set the values of x, which are less than the mean, to zero 


f. set the values of x, which are above the mean, to their difference from the mean 




3. 
Create the vector x = randperm(35) and evaluate the following function using only logical indexing: 










You can check your answer by plotting y vs. x with symbols.
The curve should be a triangular shape, always above zero and with a maximum of
16. It might also be useful to try setting x to 




4. 
Create a 3D graphic similar to the 3D visualization as shown below. Please make your graph as silimar as the following visualization in terms of shape, color, and lighting effect. 



5. Combustion is the chemical process in which thermal energy is liberated by rapidly reacting an oxidant with a fuel. In stoichiometric combustion, a fuel is reacted with an exact amount of oxygen to completely combust the fuel. The table below lists the oxygen and air requirements for combustion of three types of hydrocarbon fuels.
Fuel Type 
O_{2}
Required (ft^{3}/ft^{3} fuel) 
Air Required (ft^{3}/ft^{3}
fuel) 
C_{n}H_{2n} 
1.50n 
7.18n 
C_{n}H_{2n+2} 
1.5n+0.5 
7.18n+2.39 
C_{n}H_{2m} 
n+0.5m 
4.78n+2.39m 
Write a function file (fuel.m) that has three input arguments and two output argument; where [O,A] = fuel(v,c,h) returns the amount of oxygen and air required to perform stoichiometric combustion. (where v is total volume required, c is number of carbon atom, & h is number of hydrogen atom)
Use your function to compute the cubic feet of oxygen and air required to combust:
5.4 ft^{3}
butane (C_{4}H_{10})
>> [O,A]=fuel(5.4,4,10)
O = 35.1000
A = 167.9940
2.1 ft^{3}
acetylene (C_{2}H_{2})
>> [O,A]=fuel(2.1,2,2)
O = 5.2500
A = 25.0950
0.7 ft^{3}
propylene (C_{3}H_{6})
>> [O,A]=fuel(0.7,3,6)
O = 3.1500
A = 15.0780