Upload
ali-gh
View
5
Download
0
Embed Size (px)
DESCRIPTION
h
Citation preview
1
University of the Witwatersrand, JohannesburgSchool of Mechanical, Industrial & Aeronautical Engineering
MECN2003: Software Development
Laboratory 5: MatLab 1
Students are to work in pairs and submit the finished lab via WebCT by 0800 themorningfollowing the tutorial.
A program is required that can determine the ’correctness’ of a uniformdistribution of an arrayof random numbers between 0 and 1. Theoretically, if numbers are distributed evenly between0 and 1, the proportion of values less than a tested percentage will be equal to that percentagee.g. 25% of the numbers will be smaller than or equal to 0.25 (i.e. 25%). In the event of a finitearray of values this condition is not met as accurately since the low number of values to be testedwould mean that a single number makes a significant difference to the proportion meeting thespecified criterion e.g. if there are 8 numbers in the array, each number represents 12.5% of thearray. The required program must determine the number of values in the anarray suplied by theuser meeting a user-defined criterion and hence determine the proportion of the total array thisrepresents. Finally, this proportion must be reported to the user. Use of command line input andoutput is permitted. The array supplied may be generated using the MatLab funtion rand.
Bonus marks will be awarded for elements of the code which improve the robustness / flexibilitythereof such as input checking and re-entry of information if it is incorrect in format or such.
Programs are to be submitted via the Blackboard / Ignite interface. Students must submit onlytheir program file named MatLab1Groupn.m, wheren is their group number on the MECN2003Ignite page. [20 Marks + 2 Bonus Marks]