Having trouble with interp2 within a for loop
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!