Study Guides (238,157)
CIVE 121 (4)

# W2013_syntax_sheet_ver02.pdf

1 Page
87 Views

School
University of Waterloo
Department
Civil Engineering
Course
CIVE 121
Professor
Robert Mc Killop
Semester
Winter

Description
1 of 1 Vector Functions total = sum(vec) avg = mean(vec) num = length(vec) [value_max, index] = max(vec) array = randi([1, 6], 5, 2) array = rand(5, 2) [sorted_vec, order] = sort(vector, 'ascend' or 'descend') Find and Logical index = find(logical expression) index = findstr(target_string, search_string) Character Arrays string = num2str(numeric value) numeric value = str2num(character vector) Cell Arrays cell = {elements} element = cell{index} string = char(cell{index}) File IO [col1, col2, etc.] = textread(filename, '%s%f etc.') numeric_array = dlmread(filename) fid = fopen(filename) cell_array = textscan(fid, '%s%f%f') fclose(fid) Numerical Integration and Differentiation I = quad(f_handle, a, b) I = trapz(x_vector, y_vector) dydx_vector = gradient(y_vector, x_vector) der_coeff = polyder(coeff) int_coeff = polyint(coeff) Interpolation y_interp = interp1(x, y, x_interp, 'linear') y_interp = interp1(x, y, x_interp, 'spline') Polynomials y_vector = polyval(coeff, x_vector) coeff = conv(coeff1, coeff2) coeff = polyfit(x_vector, y_vector, degree) Optimization an
More Less

Related notes for CIVE 121

OR

Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Join to view

OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.