フィルターのクリア

Couldn't find the position of a value in vector

4 ビュー (過去 30 日間)
Enez Furkan Cihan
Enez Furkan Cihan 2018 年 11 月 24 日
コメント済み: Enez Furkan Cihan 2018 年 11 月 24 日
tryna find a value's location but gives me empty double row vector, why?
My vector is q and its size 1x4406 double. couldn't find out where 0.0500 is. Tried to use this " k=find(q==0.0500) " but didn't get anything worth.
Thanks in advance

採用された回答

the cyclist
the cyclist 2018 年 11 月 24 日
編集済み: the cyclist 2018 年 11 月 24 日
The value is not exactly equal to 0.05, due to floating point representation. Try
tol = 1.e-6;
k=find(abs(q-0.0500)<tol);
  5 件のコメント
the cyclist
the cyclist 2018 年 11 月 24 日
Here are the elements that are nearest 0.05. Note that none of them are equal to 0.05. They are also not even with 1.e-6, which is why my code did not work.
You can change my value of tol to get as close as you need.
format long
q(2198:2206)
ans =
Columns 1 through 6
0.049918594104308 0.049941269841270 0.049963945578231 0.049986621315193 0.050009297052154 0.050031972789116
Columns 7 through 9
0.050054648526077 0.050077324263039 0.050100000000000
Enez Furkan Cihan
Enez Furkan Cihan 2018 年 11 月 24 日
how i couldn't think that! Thank you so much. I appreciate.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by