Create Matlab code to perform the following calculations: 3 = 4 + 5/6 + 9 (5+2)^
ID: 3120401 • Letter: C
Question
Create Matlab code to perform the following calculations: 3 = 4 + 5/6 + 9 (5+2)^2 +8^2 -3/5 6 4/5 + 8 -3 * 2^2 1 + 5 * 3/6^2 + 2^2-4 * 1/5.5 (a) The volume of a cylinder is pr^2 h. Define r = 3 and h = [l, 5, 12]. Find the volume of the cylinders. (b) The area of a triangle is 1/2* base*height. Define the base = [2, 4, 6] and the height = 12, find the area of the triangles. Generate a table of conversions from degrees to radians. The first line should contain the values for 0 degree, the second line should contain the value of 10 degree, and so on. The last line should contain the values for 360 degree. Generate a table of conversions from centimeters to inches. Start the centimeter column at 0 and increment by 2 centimeters. The last line should contain the value 30cm.Explanation / Answer
1) 3 + (4+5)/6 +9
power((5+2),2) + power(8,2) - 3/5
(5*6+4)/5 + 8 - 3 * power(3,2)
1 + 5*3/power(6,2) + power(2,2-4)*1/(5*5)
2) r = 3
rsq = power(r,2)
h =[1,5,12]
area = pi*rsq*h
3) deg = [0:10:360]
confac = pi/180
rad = confac * deg
table(deg,rad)
4) cms = [0:2:30]
confac = 1/2.54
inch = confac*cms
table(cms,inch)