Having trouble with interp2 within a for loop
Show older comments
Hello, I'm having a little issue with my for loop using interp2:
%For enthalpy given the temperature and pressure
p1 = 20:0.03:200;
t1 = 5:1:500;
for i = 1:length(p1)
for j = 1:length(t1)
rho(i,j) = interp2(p1,t1,rho_ph)
end
end
%For density given the pressure and enthalpy
p2 = 500:1:1100;
t2 = 200;
for k = 1:length(p2)
for l = 1:length(t1)
h_pt(k,l) = interp2(p2,t2,h_pt)
end
end
This is the error:
Error using griddedInterpolant
Interpolation requires at least two sample points in each dimension.
Error in interp2/makegriddedinterp (line 214)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 111)
F = makegriddedinterp({X,Y},V,method,extrap);
I'm not really understanding what is being asked.
Accepted Answer
More Answers (0)
Categories
Find more on Waveform Generation 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!