CIVE121 Lecture Notes - Lecture 2: Semicolon, Standard Deviation, Row And Column Vectors

164 views3 pages

Document Summary

Unassigned vector values are assigned default value of zero a = 1:5 x= 100 a(10)= x a = 1 2 3 4 5 0 0 0 0 100. Matlab is able to automatically process row and column vectorsm e. g. a = [0, 90, 180, 270], y= sind(a), y= 0 1 0 -1 max() sort() sort() [what, where] = max(input) scores = [8. 6, 7. 9, 9. 2, 8. 3, 8. 8] [dummy, index] = min(score) scores[index] = [] scores = 8. 6 8. 3 8. 8 ascending/ descending order sorted_vector = sort(original_vector,mode), automatic ascends mode is ascend", descend" (quotation marks required, string) can provide multiple outputs like the max function: [sorted_vector, index_vector]= sort(original_vector, mode) grades = [ 55, 66, 77, 88, 99] list = sort(grades,"descend") bottom3 = list(end-2:end) bottom3 = 77 66 55 grades = [ 66, 55, 77, 88, 99] [sorted_grades, order] = sort(grades,"descend") remembers order sorted_grades = 99 88 77 66 55 order = 5 4 3 1 2.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents