Why is the interp1 function is returning all zeros? I try to interpolate excell data.

6 views (last 30 days)
able1 = xlsread ('TTB_Table_1_digitized');
Table6 = xlsread('TTB_Table_6_digitized');
Proof = Table6 (:,1);
SGair = Table6 (:,4);
Achol = Table6 (:,2);
SGV = Table6(:,5);
alpha = 25*10^-6;
DensityWater = 0.99904;
Tempex1 =[24 25 25 25.6 25.2 24.2 24.1 24.1];
% calcuating C2 by using the interpolstion function.
for i = length(SGair)
C(i) = interp1(Proof,SGV,SGair(i));
end
for i = length(C)
SG(i) = C(i)/DensityWater;
end
  1 Comment
Walter Roberson
Walter Roberson on 24 Feb 2018
We don't know -- we have no information on the range of data that you are interpolating.
Note:
for i = length(SGair)
C(i) = interp1(Proof,SGV,SGair(i));
end
can be replaced by
C = interp1(Proof, SGV, SGair);

Sign in to comment.

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!