SUNY Geneseo Department of Mathematics
Friday, September 25
Math 230 01
Fall 2015
Prof. Doug Baldwin
findpeaks
function?help findpeaks
to see if you have it>> help findpeaks
findpeaks Find local peaks in data
…
array( int )
picks element at position int
array( int1:int2)
picks out elements from positions
int1
to int2
array( n ) = value
[ array1, array2 ]
[]
size()
gives you the size of an arrayend
indexes end element in arrayend-1
, end-2
, etc.>> v = [ 1 3 5 7 9 11 ]
v =
1 3 5 7 9 11
>> a = v( end:-1:end-6 )
Subscript indices must either be real positive integers or
logicals.
>> a = v( end:-1:end-5 )
a =
11 9 7 5 3 1
>> a = fliplr( v )
a =
11 9 7 5 3 1
>> a = v( end:-1:1 )
a =
11 9 7 5 3 1
>> % Rearrange a vector, e.g., to be in sorted order
>> v = [ 4 2 8 9 1 ]
v =
4 2 8 9 1
>> v( [ 5 2 1 3 4 ] )
ans =
1 2 4 8 9
>> size( v )
ans =
1 5
>> length( v )
ans =
5
>> s = size( v )
s =
1 5
>> s(2)
ans =
5
>> [r c] = size( v )
r =
1
c =
5
>> numbers = [ 17 ]
numbers =
17
>> numbers(2) = 82
numbers =
17 82
>> numbers = [ numbers, numbers ]
numbers =
17 82 17 82
>> numbers = [ numbers, numbers ]
numbers =
17 82 17 82 17 82 17 82
>> numbers = [ numbers, numbers ]
numbers =
Columns 1 through 10
17 82 17 82 17 82 17 82 17 82
Columns 11 through 16
17 82 17 82 17 82