function AceLumber - % values. relFreq =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function AceLumber(lumber) % AceLumber - plot a histogram and relative distribution % curve of the input variable lumber. % INPUTS: lumber - a vector of a values to plot % OUTPUTS: none % SAMPLE CALL: first get the data: % lumberData = xlsread('QC_AceBoards.xls', 'B2:B121'); % AceLumber(lumberData); % Find the smallest and the largest values in the data lowVal = floor(min(lumber)); hiVal = ceil(max(lumber)); % Create the bins vector. Since we want bins with edges 93, 94, 95 . .. etc, % the bin centers will be 93.5, 94.5, 95.5 . .. etc. binCenters = (lowVal+0.5):1:hiVal; % Get the bin counts binCounts = hist(lumber,binCenters); % show the histogram bar(binCenters,binCounts); % Compute the relative frequency. We multiply by 100 to get the percentage
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % values. relFreq = binCounts/sum(binCounts)*100; hold all % Plot the relative frequency in red plot(binCenters,relFreq,'- .r'); % label the tolerance limits text(98.5,relFreq(find(binCenters==98.5)),'lower limit of tolerance','color','g'); text(101.5,relFreq(find(binCenters==101.5)),'upper limit of tolerance','color','g'); % Find the bins which are within tolerance ndxInTolerance = find(binCenters >= 98 & binCenters <= 102); % Re-plot the bins within tolerance with blue color plot(binCenters(ndxInTolerance),relFreq(ndxInTolerance),'- .b'); xlabel('Board length') ylabel('Frequency'); title('Histogram and Relative frequency'); legend('Histogram', '% Rative Frequency', 'Within tolerance');...
View Full Document

Ask a homework question - tutors are online