Effacer les filtres
Effacer les filtres

How can I get the interpolated value of and array

11 vues (au cours des 30 derniers jours)
ricard molins
ricard molins le 13 Mai 2015
Commenté : ricard molins le 13 Mai 2015
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

Réponse acceptée

Thomas Koelen
Thomas Koelen le 13 Mai 2015
interp1(height,distance,heightinput)
  1 commentaire
ricard molins
ricard molins le 13 Mai 2015
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

Connectez-vous pour commenter.

Plus de réponses (2)

Michael Haderlein
Michael Haderlein le 13 Mai 2015
>> doc interp1

Purushottama Rao
Purushottama Rao le 13 Mai 2015
c= fit([1; 2; 3 ;4],[10 ;20; 30; 40],'poly2')
  1 commentaire
Purushottama Rao
Purushottama Rao le 13 Mai 2015
Later u can call c(1.5) results in 15

Connectez-vous pour commenter.

Catégories

En savoir plus sur Linear Algebra dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by