Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a Matlab script named accessID_spheres that will calculate the surface

ID: 2267884 • Letter: 1

Question

1. Write a Matlab script named accessID_spheres that will calculate the surface area and volume of five spheres. The script should prompt the user to enter one vector containing 5 numbers (diameters). Calculate the surface area and volume for spheres with diameter of 2,4,6,8 and 10 cm Use fprintf to generate a table like the one shown below (your numbers may be different); the numbers should have five digits to the right of the decimal: Volume (cm 3) 0. 52360 4. 18879 14. 13717 33. 51032 65. 44985 Surface Area (cm 2) 3. 14159 12. 56637 28. 27433 50. 26548 78. 53982

Explanation / Answer

Matlab Script:

D = input('Please enter vector of diameters:');
SA = 4*pi*(D.^2)/4;
V = (4/3)*pi*(D.^3)/8;

disp('Volume (cm^3) Surface Area (cm ^2)');
for i=1:length(D)
fprintf('%f %f ',V(i),SA(i));
end

Command window log:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote