Interpolating data from a table

66 Ansichten (letzte 30 Tage)
Rifat Ibn Azad Tanim
Rifat Ibn Azad Tanim am 12 Nov. 2020
Kommentiert: Cris LaPierre am 13 Nov. 2020
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.

Antworten (1)

Cris LaPierre
Cris LaPierre am 12 Nov. 2020
Bearbeitet: Cris LaPierre am 12 Nov. 2020
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 Kommentare
Rifat Ibn Azad Tanim
Rifat Ibn Azad Tanim am 12 Nov. 2020
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 am 13 Nov. 2020
You could use the rmmissing and/or fillmissing functions to handle NaNs.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by