Chapter 2, continued: Cell arrays Know two methods for creating/editing data Store mixed data types Structure arrays Data structure with named fields structure(rec_num).field
Chapter 3: Built-in math functions exp(), sqrt(), log(), log10(), cos(), sin() fzero(), fminsearch() Importing data
Chapter 3, continued: User-defined functions: function [outputs] = f_name(inputs) Store as f_name.m Use as in: >> [outputs] = f_name(inputs) Variables in function are local (deleted after function finishes) unless defined as global
Chapter 4, continued: If – structure if logical 1 Block 1 elseif logical 2 Block 2 else Block 3 end
Chapter 4, continued: Switch – structure Switch switch_var Case value 1 Block 1 Case value 2 Block 2 Otherwise Block 3 end
Chapter 4, continued: For – loops for loop_var = m:s:n Block Loop_var = … % NOT ALLOWED A(loop_var) = … % ALLOWED … = Loop_var … % ALLOWED end
Chapter 4, continued: While – loops While logical statement Block Something that changes logical statement end
Chapter 4, continued: Flow control commands break, continue
Chapter 5: Basic plotting commands plot(), axis(), xlabel(), ylabel(), title(), text() grid on, hold on, grid off, hold off Different plot types plot(), loglog(), semilogy(), semilogx() Different symbol types ‘bo-’, ‘o--’, ‘.-’, ‘b’, ‘o’, etc.
Chapter 5, continued: Three-dimensional plots mesh(), surf(), contour(), plot3() [x, y] = meshgrid(x, y) Z = x.*x, etc.
Chapter 5, continued: Linear, power, and exponential functions Polynomial fitting polyfit(), polyval() Linear regression y/x, etc. Plotting multiple plots in a single figure subplot, hold