How can I get the interpolated value of and array

조회 수: 31 (최근 30일)
ricard molins
ricard molins 2015년 5월 13일
댓글: ricard molins 2015년 5월 13일
I have 2 arrays, one with distances and one with heigth.
heigth = [10 20 30 40]
distance = [1 2 3 4]
I want to be able to get the heigth at any given value from 1 to 4. The main idea is to be able to do:
getHeigth(1.5) --> 15

채택된 답변

Thomas Koelen
Thomas Koelen 2015년 5월 13일
interp1(height,distance,heightinput)
  댓글 수: 1
ricard molins
ricard molins 2015년 5월 13일
The solution is correct although I asked for interpolating heigth when introducing the distance. It's just need to swap the arguments.
Thanks for your answer

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Michael Haderlein
Michael Haderlein 2015년 5월 13일
>> doc interp1

Purushottama Rao
Purushottama Rao 2015년 5월 13일
c= fit([1; 2; 3 ;4],[10 ;20; 30; 40],'poly2')

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by