Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Interpolation problem. How can I generalize for a bigger number of intervals?

1 回表示 (過去 30 日間)
GEORGIOS BEKAS
GEORGIOS BEKAS 2020 年 6 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Imagine that I want to express in a way that I will describe below, a number that falls into a possible range of values.
E.g. the worse value is 30 and the best is 2.
So 16 would be expressed as: 1*w1 + 0*w2.
And 3 would be expressed as: 1*w1 + 0.93*w2.
What is a general code for this pattern?
What if I would want to include more intervals?
Is the following code correct?
function [w1 w2] = intrpolate(worse,best, given)
md = (worse+best)/2
if given >= md
int = (given-md)/(best - md)
w1 = 1
w2 = int
else
int = abs((given-md))/(worse - md)
w1 = int
w2 = 0
end
end
  1 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 6 月 15 日
The interpolation rule is not clear. What are the values of w1 and w2? Why is 16 expressed as 1*w1 + 0*w2? Same for 3 = 1*w1 + 0.93*w2???

回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by