Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB Rounded input of a chemical plant A chemical plant has an input of 10 different materials per day for daily operation. Each input material
MATLAB
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 materiais, calculates the sum of the weights, and then returns the sum. Then output the returned sum to two decimal places. Ex: Given weightArray = 68.6611 8.7929 71.6766 44.1901 76.2861 66.1515 22.6083 36.9491 52.6495 65.6995 Output: The daily sum of all the materials is 513.66 tons Function Save Reset 9. MATLAB Documentation 1 function dailyMaterialsum = Materialsum (weightArray) 2 % Write a function that sums the elements of the weightArray 3 % and prints the result to 2 decimal points 4 dailyMaterialsum = 5 end 6 Code to call your function C Reset 1 % The weight of each material is in tons and is between 1 and 100 tons. 2% You can generate N random numbers in the interval (a,b) with the formula 3% -a + (b-a). *rand (N, 1). 4 5 weightArray = (1 + (100 - 1)*(rand (10,1))) 6 7 dailyMaterialsum = Materialsum(weightArray)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