フィルターのクリア

I want to understand the meaning(Syntax) of this line. Someone please explaiin what conditions are being used and what does it exactly mean in terms of variables used

1 回表示 (過去 30 日間)
Kf(fmag<=1) = ((1-(nimage*magnification*fth(fmag<=1)).^2)

採用された回答

James Tursa
James Tursa 2018 年 1 月 22 日
編集済み: James Tursa 2018 年 1 月 22 日
The result of fmag<=1 is a logical variable. The expression fth(fmag<=1) picks of those elements of fth that are at the locations of the "1" elements of the logical indexing. I.e., it picks off the fth values at the locations where fmag<=1 is true. The remaining expression on the rhs of your assignment is then evaluated for those elements, and the results are stored in the same locations (using the same logical indexing) of the Kf variable. E.g.,
>> fth = 1:10
fth =
1 2 3 4 5 6 7 8 9 10
>> Kf = zeros(size(fth))
Kf =
0 0 0 0 0 0 0 0 0 0
>> fmag = 2*rand(1,10)
fmag =
1.4121 0.0637 0.5538 0.0923 0.1943 1.6469 1.3897 0.6342 1.9004 0.0689
>> fmag<=1
ans =
1×10 logical array
0 1 1 1 1 0 0 1 0 1
>> Kf(fmag<=1) = fth(fmag<=1)
Kf =
0 2 3 4 5 0 0 8 0 10
  1 件のコメント
Sagar  Saxena
Sagar Saxena 2018 年 1 月 22 日
Thanks But I didn't quiet get it. Is it possible for you to give a simple example and explain something similar ? 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