How to set a value according to a range without using a for loop?

2 ビュー (過去 30 日間)
Gabriel Melendez
Gabriel Melendez 2020 年 2 月 4 日
コメント済み: Gabriel Melendez 2020 年 2 月 5 日
Hello everybody.
I need to obtain values using next function:
where
I created an array gu to store all gu values from 0 to 128 using the function g.
The r values (to obtain ) are stored into an array called dct_values.
It is possible to compute values without using for loop (for example, when gu ⩽ r < gu+1) ?
Thanks for your help.
u = [0:128];
gu = g(u);
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 2 月 4 日
u = 0:128;
gu = u.^2/90 + u/3;
Now consider discretize() of r with bins [-fliplr(gu), gu] . Then the bin-number can be used to index the replacement matrix [-128, -fliplr(u)-1, u, 127]
Gabriel Melendez
Gabriel Melendez 2020 年 2 月 5 日
Thank you very much for your answer!

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by