Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Interpolation code. How can I deal with a strange problem.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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?
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
0 Commenti
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!