Question: USING MATLAB: Create a script m-file that calculates the mass of a rectangular prism with a center hole as the hole diameter increases Allow the
USING MATLAB:
Create a script m-file that calculates the mass of a rectangular prism with a center hole as the hole diameter increases
Allow the user to enter the following
rectangular prism parameters (W and L)
starting hole diameter (d)
hole diameter increment size (step)
density of the prism material (rho)
For each valid hole diameter, output the following values in a table
W, L, d (current value), rho, m (mass)
Include units in header
Assume that the prism cross section is a square and that the hole is centered
Units are as follows:
W (meters), L (meters), and d (meters), rho (kg/m3), m (kg)
Here is a sample output:

This is what I have, but I can't get the table output to work:
%Inputs w=input('Enter the width of block (in meters) :'); l=input('Enter the length of block (in meters):'); d=input('Enter the starting diameter of hole (in meters) :'); step=input('Enter hole diameter increment size (in meters):'); rho=input('Enter the density of the prism material (in kg/m^3):'); count=0;
%Calculate the volume Volume=(w)^2*l;
%while loop while d
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
