Interpolating data from a table

68 次查看(过去 30 天)
Hello,
I'm trying to get the interpolated Cl and Cd from this table. For example, say for -173.2 AOA, I want to find out the corresponding Cl & Cd. The file here is an excel file and I have imported them into matlab and named the variable naca which is the size of 395*4. I have also tried interp1 function to interpolate.
For example,
I tried, interp1(naca.AOA, naca.Cl, -173.2);
The error it gives out is- "Error using griddedInterpolant
The sample points must be finite.
Error in interp1 (line 170)
F = griddedInterpolant(X,V(:,1),method);"
Any help regarding this would be really appreciated.

回答(1 个)

Cris LaPierre
Cris LaPierre 2020-11-12
编辑:Cris LaPierre 2020-11-12
Works here. Perhaps try clearing your workspace and then rerunning your code.
AOA = (-180:1:-167)';
Cl = sort(rand(size(AOA))-0.15);
Cd = sort(rand(size(AOA)));
naca=table(AOA,Cl,Cd)
naca = 14x3 table
AOA Cl Cd ____ __________ ________ -180 -0.14264 0.068609 -179 -0.10548 0.10965 -178 -0.05547 0.12092 -177 -0.051742 0.18885 -176 -0.0049866 0.49856 -175 0.027617 0.50889 -174 0.0449 0.5568 -173 0.11746 0.62728 -172 0.14203 0.67654 -171 0.29605 0.68496 -170 0.3297 0.87587 -169 0.75624 0.88073 -168 0.77464 0.91418 -167 0.81968 0.91765
interp1(naca.AOA,naca.Cl,-173.2)
ans = 0.1030
  2 个评论
Rifat Ibn Azad Tanim
Hi,
Thank you so much for replying. Turns out I couldn't do it because I had NaNs in the table. I had to get rid of the NaNs to get it working. Any idea as to how to get around those NaNs? Anyway, for now, it's working. Thank you very much again.
Cris LaPierre
Cris LaPierre 2020-11-13
You could use the rmmissing and/or fillmissing functions to handle NaNs.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by