Look Up table Random breakpoints

In case of 1-D lookup table, input vector must be strictly monotonically increasing. I have some breakpoints which are constant. for e.g [1 2 3 3 3 4 5 5] Is there anyway to implement this

2 件のコメント

Guillaume
Guillaume 2018 年 7 月 18 日
Suppose the value you're looking up is 3, which of the 3 should be picked up in your breakpoint table?
ashwini ingale
ashwini ingale 2018 年 7 月 24 日
the last value i.e. at last point among the three, so at breakpoint 4 in case of value 3

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

回答 (1 件)

Guillaume
Guillaume 2018 年 7 月 24 日

0 投票

the last value i.e. at last point among the three, so at breakpoint 4 in case of value 3
Then simply remove all duplicate breakpoint (and corresponding values) keeping only the last:
breakpoints = [1 2 3 3 3 4 5 5];
values = [1 2 3 4 5 6 7 8];
[newbreakpoints, indices] = unique(breakpoints, 'last');
newvalues = values(indices);
interp1(newbreakpoints, newvalues, [2.5 3.5])

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

質問済み:

2018 年 7 月 18 日

回答済み:

2018 年 7 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by