Answered step by step
Verified Expert Solution
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 different materials per day for daily operation. Each input material weighs more than ton and doesn't exceed 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 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 tons
Function
Save
C Reset
i MATLAB Documentation
function dailyMaterialsum Materialsum weightArray
Write a function that sums the elements of the weightarray
and prints the result to decimal points
dailyMaterialSum round MaterialSum
end
Code to call your function
The weight of each material is in tons and is between and tons.
You can generate random numbers in the interval with the formula
weightArray rand
dailyMaterialSum MaterialSumweightArray
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started