Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rounded input of a chemical plant A chemical plant has an input of 1 0 different materials per day for daily operation. Each input material

Rounded input of a chemical plant
A chemical plant has an input of 10 different materials per day for daily operation. Each input material weighs more than 1 ton and doesn't exceed 100 tons. At the end of the day the weight of all the input materials are added and rounded up for general bookkeeping on material consumption.
Write a function called MaterialSum() that takes a row array with the weights of 10 materials, calculates the sum of the weights, and then returns the sum. Then, output the returned sum to two decimal places.
Ex: Given:
Output:
The daily sum of all the materials is 513.66 tons
Function 8
Save
C Reset
i MATLAB Documentation
1 function dailyMaterialsum = Materialsum (weightArray)
% Write a function that sums the elements of the weightarray
% and prints the result to 2 decimal points
dailyMaterialSum = round (MaterialSum,2)
end
Code to call your function 0
1 The weight of each material is in tons and is between 1 and 100 tons.
% You can generate N random numbers in the interval (a,b) with the formula
%r=a+(b-a)***rand(N,1).
weightArray =(1+(100-1)**( rand (10,1)))'
dailyMaterialSum = MaterialSum(weightArray)
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Define procedural justice. How does that relate to unions?

Answered: 1 week ago