필터 지우기
필터 지우기

Interpolation using Excel Data

조회 수: 22 (최근 30일)
Veronica Vigil
Veronica Vigil 2023년 8월 18일
댓글: Star Strider 2023년 8월 19일
Hello. Newb here. I have a set of data in Excel (attached) that I would like to plot and interpolate and show the below and after plots (before interpolation and after). I have tried to follow various examples on interpolation, but am having a hard time understanding how to use my data in the code itself since I have an array of various answers. Right now my table is in 10s, and I want to interpolate the values between 10 and 20, 20 and 30,etc for inclination, and 300 and 310, etc for each.
I tried to see if I can figure out how to just interpret between the each and then manually enter into excel, but I'm having trouble here too.
What I'd REALLY love is all the values interpolated based on the data I have an plot the before (not interpolated) and after (after interpolation) on a 2D meshgrid.
Help??
thanks!
Veronica

채택된 답변

Star Strider
Star Strider 2023년 8월 18일
One approach —
% C1 = readcell('FluxData.xlsx')
T1 = readtable('FluxData.xlsx')
T1 = 92×20 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16 Var17 Var18 Var19 Var20 ____________ ____ _________ _________ __________ _________ _________ _________ _________ _________ _________ _________ _________ _________ _________ _________ _________ _________ __________ _________ {0×0 char } NaN 10 20 30 40 50 60 70 80 90 98 100 110 120 130 140 150 160 170 {'Altitude'} 300 3.421e-08 4.059e-08 5.242e-08 4.567e-08 4.147e-08 4.287e-08 3.951e-08 5.478e-08 6.376e-08 5.2e-08 4.925e-08 5.238e-08 6.125e-08 8.317e-08 7.686e-08 9.879e-08 8.283e-08 1.058e-07 {0×0 char } 310 4.252e-08 4.075e-08 3.614e-08 3.472e-08 3.756e-08 4.766e-08 5.917e-08 9.377e-08 8.392e-08 6.897e-08 7.078e-08 6.61e-08 6.631e-08 6.824e-08 7.123e-08 7.971e-08 7.926e-08 1.074e-07 {0×0 char } 320 7.164e-08 5.049e-08 5.291e-08 5.516e-08 5.649e-08 5.612e-08 7.005e-08 9.938e-08 1.056e-07 7.96e-08 8.31e-08 7.555e-08 7.661e-08 8.905e-08 9.13e-08 9.877e-08 9.812e-08 1.451e-08 {0×0 char } 330 6.99e-08 6.738e-08 6.263e-08 6.359e-08 7.276e-08 7.841e-08 9.61e-08 1.328e-07 1.195e-07 1.03e-07 8.31e-08 9.903e-08 1.084e-07 1.45e-07 1.176e-07 1.195e-07 1.273e-07 1.55e-07 {0×0 char } 340 8.915e-08 9.009e-08 8.952e-08 9.115e-08 1.041e-07 1.155e-07 1.155e-07 1.383e-07 1.521e-07 1.588e-07 1.49e-07 1.401e-07 1.601e-07 1.576e-07 1.398e-07 1.505e-07 1.517e-07 1.806e-07 {0×0 char } 350 6.648e-08 6.913e-08 7.1654e-08 8.288e-08 9.692e-08 9.374e-08 1.076e-07 1.449e-07 1.487e-07 1.495e-07 1.557e-07 1.37e-07 1.464e-07 1.74e-07 1.494e-07 1.228e-07 1.298e-07 1.342e-07 {0×0 char } 360 3.693e-08 3.502e-08 3.39e-08 5.745e-08 5.058e-08 4.978e-08 5.355e-08 5.868e-08 5.487e-08 6.224e-08 6.003e-08 6.538e-08 6.881e-08 7.896e-08 8.467e-08 7.157e-08 8.227e-08 1.002e-07 {0×0 char } 370 5.007e-08 4.519e-08 6.075e-08 5.858e-08 7.319e-08 7.767e-08 8.992e-08 1.312e-07 1.2e-07 1.082e-07 1.036e-07 9.134e-08 8.91e-08 1.035e-07 8.078e-08 9.484e-08 8.471e-08 1.128e-07 {0×0 char } 380 1.015e-07 1.218e-07 1.18e-07 1.095e-07 1.225e-07 1.182e-07 1.43e-07 1.751e-07 1.67e-07 1.949e-07 1.854e-07 1.649e-07 1.544e-07 1.816e-07 1.681e-07 1.639e-07 2.052e-07 1.928e-07 {0×0 char } 390 1.736e-07 1.719e-07 1.778e-07 1.762e-07 1.878e-07 2.038e-07 2.198e-07 2.71e-07 2.676e-07 2.728e-07 2.714e-07 2.668e-07 2.832e-07 3.08e-07 3.1e-07 3.63e-07 3.356e-07 3.484e-07 {0×0 char } 400 2.332e-07 2.047e-07 1.974e-07 2.229e-07 2.276e-07 2.164e-07 2.279e-07 2.537e-07 2.677e-07 2.801e-07 2.875e-07 2.813e-07 3.398e-07 5.263e-07 4.309e-07 4.082e-07 4.348e-07 4.333e-07 {0×0 char } 410 2.381e-07 2.241e-07 2.334e-07 2.295e-07 2.518e-07 2.828e-07 3.154e-07 3.751e-07 4.007e-07 3.984e-07 4.108e-07 4.561e-07 5.326e-07 6.362e-07 4.896e-07 4.367e-07 4.64e-07 3.828e-07 {0×0 char } 420 1.659e-07 1.775e-07 1.725e-07 1.807e-07 1.963e-07 2.064e-07 2.414e-07 3.832e-07 3.569e-07 3.665e-07 3.226e-07 2.415e-07 2.383e-07 2.505e-07 2.408e-07 2.306e-07 1.2265e-07 2.262e-07 {0×0 char } 430 2.06e-07 2.134e-07 2.252e-07 2.396e-07 2.562e-07 2.745e-07 2.848e-07 3.262e-07 3.018e-07 2.898e-07 2.913e-07 3.03e-07 3.328e-07 3.469e-07 3.256e-07 2.855e-07 2.664e-07 2.707e-07 {0×0 char } 440 2.179e-07 2.418e-07 2.155e-07 2.035e-07 2.293e-07 2.359e-07 2.696e-07 3.338e-07 3.318e-07 3.271e-07 3.321e-07 3.001e-07 2.99e-07 3.114e-07 2.979e-07 2.859e-07 3.131e-07 2.735e-07
xvar = T1{1,3:end};
yvar = T1{2:end,2};
A = T1{2:end,3:end};
figure
surf(xvar, yvar, A)
colormap(turbo)
colorbar
xlabel('Inclination')
ylabel('Altitude')
zlabel('Flux')
[Xu,Yu] = meshgrid(xvar, yvar);
interpv = 5;
xq = linspace(min(xvar), max(xvar), numel(xvar)*interpv);
yq = linspace(min(yvar), max(yvar), numel(yvar)*interpv);
[Xi,Yi] = meshgrid(xq,yq);
Ai = interp2(Xu,Yu,A,Xi,Yi);
figure
surf(Xi, Yi, Ai)
colormap(turbo)
colorbar
xlabel('Inclination')
ylabel('Altitude')
zlabel('Flux')
Experiment with idfferent interp2 interpolation methods to get the desired result.
.
  댓글 수: 7
Veronica Vigil
Veronica Vigil 2023년 8월 19일
This is awesome. Thank you, this helped me get to where I need to be.
Star Strider
Star Strider 2023년 8월 19일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by