Get a value of non existant index of array by interpolation

조회 수: 6 (최근 30일)
CLEBER ALBERT
CLEBER ALBERT 2016년 9월 3일
답변: Star Strider 2016년 9월 3일
Im trying to remember a function in Matlab which returns a value of non existant index of array by interpolation.
eg:
arry = [4 5 6];
index = 1.5;
suchfunction(arry,index) %should return a value between the index 1 and 2 by interpolation (would be 4.5)
ans = 4.5
Could someone help me!?

채택된 답변

Star Strider
Star Strider 2016년 9월 3일
Use the interp1 function:
arry = [4 5 6];
idx = 1:3;
idxi = 1.5;
arryi = interp1(idx, arry, idxi)
arryi =
4.5

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by