## ENGR 1120 – PROGRAMMING FOR ENGINEERS (MATLAB) Homework Program #2 Objectives: Demonstrate knowledge of data files, vector variables, intrinsic functions, subscript manipulation, for loops, and plotting in MATLAB. You have been given a set of ASCII data files that contain directions for laying out patterns in a field. The data files contain in the first column a distance to travel and in the second column a direction heading. Unfortunately, the person who created the data did not have a good understanding of orienteering and the direction headings are given as referenced to a clock face. The pattern begins at the origin of a Cartesian coordinate system with the person facing 12 o’clock, see the figure below. The figure shows an example of the first step in the pattern being a distance of 1.5 feet in the direction of 7 o’clock. All direction headings are given in terms of this clock orientation. The distance values given are in feet. There are 5 data files provided online for testing of the program. Write a script file that will allow the user to input from the keyboard the filename of the file that they wish to analyze. Load only that ONE data file and plot the resulting pattern. Once each point forming the pattern has been located, find and designate on the plot which of the resulting nodes was the farthest away from the origin. Also find and designate the center of the pattern as defined to occur at the coordinate location corresponding to (average x, average y). When plotting the resulting pattern on the Cartesian coordinate system, set the axes limits to appropriate values. HINT: Correlate the direction headings provided in the data files to a Cartesian coordinate system by using the following vector in your script file. This requires subscript manipulation. angle = [60; 30; 0; 330; 300; 270; 240; 210; 180; 150; 120; 90] -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 1 2 3 4 5 6 7 8 9 10 11 12 you are here

info@checkyourstudy.com