skip to main
|
skip to sidebar
Just Another Control System Blog
Thursday, October 22, 2009
Index of an array element closest to an arbitrary value
>> x = 1:100:1000;
The index of the array which is closest to say 130 is given by
>> [v,idx] = min(abs(x-130));
The answer is
v = 29, idx = 2
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Followers
Labels
C/C++
C++
CAS
Control
Graphviz
math
Matlab
Maxima
NN
Octave
Random Numbers
Recursion
ternary search tree
TST
Subscribe To Swagat's blog
Posts
Atom
Posts
Comments
Atom
Comments
Related Links
Awhan's Control Blog
Awhan's matlab blog
Blog Archive
►
2016
(2)
►
July
(1)
►
June
(1)
►
2012
(2)
►
September
(2)
►
2010
(8)
►
April
(2)
►
March
(3)
►
January
(3)
▼
2009
(4)
▼
October
(2)
Index of an array element closest to an arbitrary ...
Effect of Controllability and Observability On Sta...
►
September
(1)
►
August
(1)
►
2008
(8)
►
June
(1)
►
May
(1)
►
April
(4)
►
March
(2)
pre { margin: 5px 20px; border: 1px dashed #666; padding: 5px; background: #f8f8f8; white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ }
No comments:
Post a Comment