Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me with my code? Ive tried multiple different solutions with no avail. manufacturing standards for sale. workspace. Make sure the barData.mat file
Can someone help me with my code? Ive tried multiple different solutions with no avail.
manufacturing standards for sale. workspace. Make sure the barData.mat file is in the same folder as your program. Bars have a nominal length of 10mm, a nominal width of 4mm, and a nominal height of 2mm. Bars that meet the manufacturing standards for sale should meet all of the following criteria: 1. Length within 0.5% (include) of the nominal length. (i.e, the difference between your bar and the nominal bar should be within 0.5% of the nominal length in both directions) 2. Width within 0.5% of the nominal width. 3. Height within 0.25% of the nominal height. 4. Weight should not exceed 362g. The program should clearly display the following: 1. Number of bars that meet the manufacturing standard, assign it to number_of_good_bars 2. Average length, width, and height of the bars that meet the manufacturing standard, assign them to avg_length, avg_width, and avg_height respectively. 3. Minimum weight of the bars that meet the manufacturing standard, assign it to min_weight Make sure that: 1. The program clearly displays the number of bars, average dimensions, and minimum weight of the bars that meet the standard. 2. The program will work for any bar data of the specified form ( N by 4 arrays), not just for the data in the supplied MATLAB workspace file. 3. abs(),mean(),min(),max(), size() etc. may help \%Extract length, width, height, and weight of bars from tiBarData length = tiBarData (:,1); width = tiBarData (:,2); height = tiBarData (:,3); weight = tiBarData (:,4); \%define nominal length, nominal width, and nominal height of bar in mm nomLength =10; nomWidth=4; nomHeight =2; \%find boolean array of good bars, should be a nx1 vector with either 0 or 1 , n is the total number of bars booleangoodBar =( length =( nomLength*0.5)) \& (width =( nomWidth* 0.5)) \& ( height =( nomHeight* 0.25) ) \& ( weight 362); \%find indices for good bars, should be a mx1 vector with indices of good bars only, m is the number of good bars goodBarsIdx= size(booleanGoodBar); number_of_good_bars = size ( goodBarsIdx ); avg_length = mean ( length >= (nomLength. 0.5) ); avg_width = mean ( width >= (nombidth. 0.5) ); avg_height = mean (height >= (nomHeight. 0.25) ); \%Find Minimum weight of the bars that meet the manufacturing standard, assign it to min_weight min_weight =min( weightStep 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