Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MATLAB program to determine how many bars from a titanium bar forging run meet the manufacturing standards for sale. The program should also

Write a MATLAB program to determine how many bars from a titanium bar forging run meet the manufacturing standards for sale. The program should also compute the average length, average width, and the average height of the bars that meet the manufacturing standards for sale.

The quality control data from the titanium bar forging run was stored in the MATLAB workspace file barData.mat. The data is stored in a 2D array named tiBarData: the first column contains the bar lengths in mm, the second column contains the bar widths in mm, the third column contains the bar heights in mm, and the fourth column contains the bar weights in g. The MATLAB statement load('barData.mat','tiBarData'); will load the variable named tiBarDatafrom the barData.mat file into the MATLAB workspace. Make sure the barData.mat file is in the same folder as your program.

Bars have a nominal length of 10 mm, a nominal width of 4 mm, and a nominal height of 2mm. Bars that meet the manufacturing standards for sale should meet all of the following criteria:

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)

Width within 0.5% of the nominal width.

Height within 0.25% of the nominal height.

Weight should not exceed 362 g.

The program should clearly display the following:

Number of bars that meet the manufacturing standard, assign it to number_of_good_bars

Average length, width, and height of the bars that meet the manufacturing standard, assign them to avg_length, avg_width, and avg_height respectively.

Minimum weight of the bars that meet the manufacturing standard, assign it to min_weight

Make sure that:

The program clearly displays the number of bars, average dimensions, and minimum weight of the bars that meet the standard.

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.

abs(), mean(), min(), max(), size() etc. may help

Below is the script to complete

% Load the data tiBarData from barData.mat

load('barData.mat','tiBarData')

%Extract length, width, height, and weight of bars from tiBarData

length=10

width=?

height=?

weight=?

%define nominal length, nominal width, and nominal height of bar in mm

nomLength=

nomWidth=

nomHeight=

%find boolean array of good bars, should be a nx1 vector with either 0 or 1, n is the total number of bars

booleanGoodBar =

%find indices for good bars, should be a mx1 vector with indices of good bars only, m is the number of good bars

goodBarsIdx=

%Find Number of bars that meet the manufacturing standard, assign it to number_of_goog_bars, you can not use length function here since length has been redefined at line 6

number_of_good_bars=

%Find Average length, width, and height of the bars that meet the manufacturing standard, assign them to avg_length, avg_width, and avg_height respectively. The good bars only.

avg_length=

avg_width=

avg_height=

%Find Minimum weight of the bars that meet the manufacturing standard, assign it to min_weight

min_weight=

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions