Cable car times: Student teams competed in a cable car competition and recorded
ID: 1840916 • Letter: C
Question
Cable car times: Student teams competed in a cable car competition and recorded their times to race across a 50 m test cable. The following times were recorded (in seconds): 8.50, 12.67, 13.50, 9.28, 10.05, 10.67, 10.05, 19.83, 15.44, 17.59, 9.77, 8.88, (add 24 more values distributed between 5.00 and 20.00) Enter the values above into Notepad in a format so that they can be read into a single column vector or row vector. Save the text file using your last name and the problem number for the file name. Write a MATLAB program to read the text file and use functions in MATLAB to find and display each of the following (including units). The program should work for a file with any number of values (not just for 36). Average time Median time Mode Standard deviation Number of cable car runs recorded tested Standard deviation Maximum time Minimum time Display the original times (4 per line) with a descriptive heading Sort the times from smallest to largest and display them again (4 per line) with a descriptive heading. Submit a copy of the text file, a copy of the MATLAB program, and a copy of the MATLAB output. All MATLAB programs should begin with a block of comments including name, course, assignment number, problem number, and a brief description of the program. Also include comments throughout the program.Explanation / Answer
>> %Enter 8.5,12.67,13.5,9.28,10.45,10.67,10.05,19.83,15.44,17.59,9.77,8.88,9.75,13.92,14.75,10.53,11.7,11.92,11.3,19.94,16.69,18.84,11.02,10.13,11,15.17,16,11.78,12.95,13.17,12.55,13.69,17.94,20.09,12.27,11.38 these 36 numbers in text file and save it as Gilat_6.txt
>> [x]=textread('Gilat_6.txt','%f');
>> x
x =
8.5000
12.6700
13.5000
9.2800
10.4500
10.6700
10.0500
19.8300
15.4400
17.5900
9.7700
8.8800
9.7500
13.9200
14.7500
10.5300
11.7000
11.9200
11.3000
19.9400
16.6900
18.8400
11.0200
10.1300
11.0000
15.1700
16.0000
11.7800
12.9500
13.1700
12.5500
13.6900
17.9400
20.0000
12.2700
11.3800
>> %average time is
>> mean(x)
ans =
13.1975
>> % median time is
>> median(x)
ans =
12.4100
>> %Mode is
>> mode(x)
ans =
8.5000
>> %standard deviation is
>> std(x)
ans =
3.3246
>> %number of cable car runs is
>> sum(x)/50
ans =
9.5022
>> %standard deviation is
>> std(x)
ans =
3.3246
>> %maximum time is
>> max(x)
ans =
20.0000
>> %minimum time is
>> min(x)
ans =
8.5000
>> %original time
>> [x(1) x(2) x(3) x(4);x(5) x(6) x(7) x(8);x(9) x(10) x(11) x(12);x(13) x(14) x(15) x(16);x(17) x(18) x(19) x(20);x(21) x(22) x(23) x(24);x(25) x(26) x(27) x(28);x(29) x(30) x(31) x(32);x(33) x(34) x(35) x(36)]
ans =
8.5000 12.6700 13.5000 9.2800
10.4500 10.6700 10.0500 19.8300
15.4400 17.5900 9.7700 8.8800
9.7500 13.9200 14.7500 10.5300
11.7000 11.9200 11.3000 19.9400
16.6900 18.8400 11.0200 10.1300
11.0000 15.1700 16.0000 11.7800
12.9500 13.1700 12.5500 13.6900
17.9400 20.0000 12.2700 11.3800
>> %sorting the numbers
>> sort(x)
ans =
8.5000
8.8800
9.2800
9.7500
9.7700
10.0500
10.1300
10.4500
10.5300
10.6700
11.0000
11.0200
11.3000
11.3800
11.7000
11.7800
11.9200
12.2700
12.5500
12.6700
12.9500
13.1700
13.5000
13.6900
13.9200
14.7500
15.1700
15.4400
16.0000
16.6900
17.5900
17.9400
18.8400
19.8300
19.9400
20.0000