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:

USING MATLAB: Create a script m-file that calculates the mass of a

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 ommand Window Enter the prism edge size: .01 Enter the prism length:1 Enter the start hole diameter: .001 Enter step size for the hole diameter: .001 Enter material density: 7750 rho 0.01 1.00 0.001 0.01 1.00 0.002 0.01 1.00 0.003 0.01 1.00 0.004 0.01 1.00 0.005 0.01 1.00 0.006 0.01 1.00 0.007 0.01 1.00 0.008 7750 0.01 1.00 0.009 7750 7750 7750 7750 7750 7750 7750 0.77 0.75 0.72 0.68 0.62 0.56 0.48 0.39 0.28 7750 47 ommand Window Enter the prism edge size: .01 Enter the prism length:1 Enter the start hole diameter: .001 Enter step size for the hole diameter: .001 Enter material density: 7750 rho 0.01 1.00 0.001 0.01 1.00 0.002 0.01 1.00 0.003 0.01 1.00 0.004 0.01 1.00 0.005 0.01 1.00 0.006 0.01 1.00 0.007 0.01 1.00 0.008 7750 0.01 1.00 0.009 7750 7750 7750 7750 7750 7750 7750 0.77 0.75 0.72 0.68 0.62 0.56 0.48 0.39 0.28 7750 47

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!