Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

On MATLAB: The goal is the same as the hw3_5, calculating the weight of the sphere. The edited program must do the following: User inputs

On MATLAB:

The goal is the same as the hw3_5, calculating the weight of the sphere. The edited program must do the following:

User inputs thickness, density and outer diameter for each run.

1) Read the first set of input from an input file

2) Calculate the mass and write the results to an output file

3) Ask the user if he/she would like to enter more data (from the keyboard this time)

4) If the user would like to enter more data...Then do the following...

5) Read new data, from the keyboard this time

6) Calculate the mass and write this next set of results to the same output file (diary)

7) Go back to step 3) and repeat to step 7) until the user decides to stop

Use the following set of input in the input file D=10.0, T=1.5, RHO=1.25 then enter the next two sets of data from the keyboard before quitting D=15.0, T=0.75, RHO=0.15 D=3.0, T=0.1, RHO=2.5

For the previous code t-thickness, d-diameter, D_out-outer diameter.

For the new/edited code T-thickness, D-diameter, RHO-outer diameter.

code for last hw:

% calculate the weight of a sphere % take in parameters and calculate the hollow sphere weight % check for user input error clear diary hw3_5 %add a directory path if you wish diary on diameter = 10.2; %the sphere OUTTER diameter thick = input('enter thickness of sphere ') while (thick<=0 | thick>diameter/2) thick = input('Bad thickness value, re-enter ') end density = 1.25; Rout = diameter/2; Rin = diameter/2 - thick; Volume = 4/3*pi*(Rout^3-Rin^3); weight = density*Volume; disp('the sphere''s weight is= ');disp(weight) diary off

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions