In: Mechanical Engineering
Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display the following expressions. Test your statements for the values a = 1.12, b = 2.34, c = 0.72, d = 0.81, and f = 19.83.
Write a MATLAB code to calculate the value of expression, x = 1 + 1/b + c/f2.
>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;
>> x = 1 + a/b + c/f^2
x =
1.4805
Therefore, the value of is 1.4805.
Write a MATLAB code to calculate the value of expression, s = b – a/d – c
>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;
>> s = (b-a)/(d-c)
s =
13.5556
Therefore, the value of is 13.5556.
Write a MATLAB code to calculate the value of expression, r = 1/(1/a + 1/b + 1/c + 1/d).
>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;
>> r = 1/(1/a + 1/b + 1/c + 1/d)
r =
0.2536
Therefore, the value of r is 0.2536.
Write a MATLAB code to calculate the value of expression, y = ab 1/c f2/2.
>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;
>> y = a*b/c*f^2/2
y =
715.6766
Therefore, the value of is 715.6766.
Therefore, the value of is 715.6766.