フィルターのクリア

finding x of y

1 回表示 (過去 30 日間)
soloby
soloby 2015 年 6 月 25 日
コメント済み: soloby 2015 年 6 月 25 日
x = -10:0.1:10;
f1 = trapmf(x,[-2 0 0 2]);
index = find(f1 ==.05);
Xidx = x(index)
Why would Xidx give me an empty matrix 1-by-0?
I know for a fact that f1 has 0.05 at the 82nd iteration

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 6 月 25 日
編集済み: Azzi Abdelmalek 2015 年 6 月 25 日
Try this
x = -10:0.1:10;
f1 = trapmf(x,[-2 0 0 2])
index=find(abs(f1-0.5)<10^(-10))
Xidx=x(index)
And read this
  1 件のコメント
soloby
soloby 2015 年 6 月 25 日
this works perfectly, thanks.
One more question, if i wanted to do this for all values of f1, would a for loop be sufficient?
something like
x = -10:0.1:10;
f1 = trapmf(x,[-2 0 0 2]);
for x = -10:0.1:10;
f1 = trapmf(x,[-2 0 0 2])
index=find(abs(f1-0.5)<10^(-10))
Xidx=x(index)
end
I'm curious how you got the f1-0.5 < 10^-10 part.,
thanks

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by