How to find X value of given Y close to zero ?

3 ビュー (過去 30 日間)
Prince Alex
Prince Alex 2020 年 7 月 15 日
コメント済み: Prince Alex 2020 年 7 月 16 日
How to find the value of Y more close to zero first (note Y consists of both positive and negative numbers) and then find the corresponding X value ? Many thanks in advance.
Lets say I have X and Y given by
X=[-51 -41 -31 -21 -11 1 11 21 31 41]
Y=[0.003 -0.002 0.004 0.0002 -0.05 0.0003 -0.001 0.006 0.01 0.0012]
  2 件のコメント
Stephen23
Stephen23 2020 年 7 月 15 日
What is the expected output from this example data?
Prince Alex
Prince Alex 2020 年 7 月 15 日
Y is 0.0002 and corresponding X value is -21. I jus given an example, I have a bit data set having 90k points and from that I have to find the Y value more close to zero and corresponding X value. Thank you.

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

採用された回答

KSSV
KSSV 2020 年 7 月 15 日
[val,idx] = sort(abs(Y)) ;
Y(idx)
X(idx)
  1 件のコメント
Prince Alex
Prince Alex 2020 年 7 月 16 日
Thank you. It worked.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBartlett についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by