How can I use interp2 with 1 query point?
Afficher commentaires plus anciens
Following the code. I can't understand what is the problem. Thank you in advance!
Is there a better method to do this type of interpolation?
s=0.12;
hth=1.23;
s_ls=[0 0.03 0.05 0.1 0.15 0.2 0.25];
hth_ls=[0.2 0.4 0.6 0.8 0.1];
k1_ls_02=[1 1 1.6 2.8 4.45 5.5 6.25]; %values of k1 for ht/h=0.2
k1_ls_04=[1 1 1.5 2.6 3.5 4.45 5.3]; %values of k1 for ht/h=0.4 and s
k1_ls_06=[1 1 1.3 1.75 2.6 3.4 3.65]; %values of k1 for ht/h=0.6
k1_ls_08=[1 1 1.2 1.5 1.9 2.15 2.3]; %values of k1 for ht/h=0.8
k1_ls_10=[1 1 1 1 1 1 1]; %values of k1 for ht/h=1.0
k1_ls=[k1_ls_02; k1_ls_04; k1_ls_06; k1_ls_08; k1_ls_10];
[s_ls_matrix,hth_ls_matrix]=meshgrid(s_ls,hth_ls);
k1=interp2(s_ls_matrix,hth_ls_matrix,k1_ls,s,hth);
2 commentaires
hth_ls=[0.2 0.4 0.6 0.8 0.1];
Is the above a typo, I'm guessing? Either the 0.1 was intended as 1.0 or it is misplaced at the end of the vector instead of the beginning.
Torsten
le 8 Oct 2022
Furthermore, you try to extrapolate to a value of 1.23 for hth (values are only given k1_ls are only give for 0.2 <= hth_ls <= 1).
interp2 will return NaN in this case.
Réponses (0)
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!