The surface area of a sphere, A, is a function of radius r and height h. This is given by the formula
A = 2$\pi$(h + r)
The moment of inertia of a solid cylinder along the X-axis, $I_x$, is a function of mass m, radius r and height h. is given by the following formula
$I_x = \frac{m}{12}(3r^2 + h^2)$
You are required to build a program that replicates this text-based interface:
Enter radius in m (min):
3
Enter radius in m (max):
4
Enter radius step size in m:
0.2
Enter height in m:
7
Enter mass in kg:
6
R: 3.00 m, A: 188.50 m$^2$, I: 38.00 kg m$^2$
R: 3.20 m, A: 205.08 m$^2$, I: 39.86 kg m$^2$
R: 3.40 m, A: 222.17 m$^2$, I: 41.84 kg m$^2$
R: 3.60 m, A: 239.77 m$^2$, I: 43.94 kg m$^2$
R: 3.80 m, A: 257.86 m$^2$, I: 46.16 kg m$^2$
R: 4.00 m, A: 276.46 m$^2$, I: 48.50 kg m$^2$
Write a MATLAB program that generates the correct output. Your program must read the values from the keyboard, and display the results in a well-formatted text table. Display
error messages if the maximum value of the radius is not greater than the minimum value of the radius value, or if the step size is not positive. Create and use functions in your
program.