70 likes | 223 Views
CS 109 C/C++ Programming for Engineers with MATLAB. Administrative Homework 10 released Due Friday, 4/18 @ 9pm Last 2 weeks? Final project Select a dataset, analyze, visualize, teams of 1 or 2 6% of final grade Twist : to earn 100, must go beyond + agree to present at final exam. 1.
E N D
CS 109 C/C++ Programming for Engineers with MATLAB • Administrative • Homework 10 released • Due Friday, 4/18 @ 9pm • Last 2 weeks? • Final project • Select a dataset, analyze, visualize, teams of 1 or 2 • 6% of final grade • Twist: to earn 100, must go beyond + agree to present at final exam 1 2 Final project due CS 109 -- 16 April 2014
Demosfrom previous classes… • Blackhawks analysis • CensusDatafor chicago • Benfordlaw analysis
Where to find Datasets? • Some good places to look… • http://www.many-eyes.com/ • http://flowingdata.com/ • https://data.cityofchicago.org/ • http://www.data.gov/ CS 109 -- 16 April 2014
Searching, part 2… • Last time… • Find rainfalls > 5.50 >> M = load('rainfall.txt'); >> D = M(:, 2:13); >> where = D > 5.50 ; where = D > 5.50; where
Extract those values? • Extract indices of those values? >> M = load('rainfall.txt'); >> D = M(:, 2:13); >> where = D > 5.50; >> vals = D(where); vals >> M = load('rainfall.txt'); >> D = M(:, 2:13); >> where = D > 5.50; >> [rows, cols] = find(where); rows cols CS 109 -- 16 April 2014
Other searches… • 5.0 < rainfall < 10.0? • rainfall < 1.0 or > 10.0? >> M = load('rainfall.txt'); >> D = M(:, 2:13); >> where = 5.0 < D & D < 10.0 ; Use a single "&" when AND'ing vector/matrices >> M = load('rainfall.txt'); >> D = M(:, 2:13); >> where = D < 1.0 | D > 10.0 ; CS 109 -- 16 April 2014
One last example… • Rainfall data for the 1930's? • First find the years we want… • Now extract the data from those rows… >> M = load('rainfall.txt'); >> where = M(:, 1) >= 1930 & M(:, 1) < 1940 ; 1930's >> data = M(where, 2:13) ; 10x12 matrix CS 109 -- 16 April 2014