{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 26 - vec(true = 3 means vec[true false false vec>3 =[0 1...

This preview shows pages 1–2. Sign up to view the full content.

A = [4 1 2 3] B = start : step : end - (Colon Operator) C = [1 : 1 : 10] D = linspace(lower limit, upper limit, # of values) E = linspace(0,2*pi,100) Z = linspace(0,1) length(Z) = 100 *default step of linspace = 100 F = zeros(1,n) G = zeros(1,10) - 10 rows of zero ones(1,n) I = rand(1,n) I = [8.43, 7.657 .... ] vec = [3 7 5] r = size(vec) r = [1 3] length(vec) = 3 *# of values in vec vec(2,3) = [7,5] vec(vec>3) = [7,5] vec([ ]) = [ ] vec(5) = 7 [3 7 5 0 7] vec = vec[1 7 3] vec = [3 7 5 1 7 3]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: vec(true) = 3 means vec([true false false]) vec>3 = [0 1 1] x = [2 6 9] y = (x[true false false]) x = [4 6 2 3] res = x(end:-1:2) = [ 3 2 7] res2 = x(3:1) = [ ] step is 1 but needs to be -1 res3 = x(x>1) = [ ] res4 = x>1 = [1 1 1 1] Vector Operations A = [5 6 7] B = [4 3 2] C = A+B C = [9 10 11] *1) when adding vectors, the length MUST be the same. *2)You can add a scalar D= A.*B D = [20 30 42] E= A.^B 3) use dot before * / ^ .* ./ .^...
View Full Document

{[ snackBarMessage ]}