Error using interp2, line226 and line126

size of Pressure=82*1, temperature=1*601, density=600*81
---------------------------------------------------------------------------------------------------------------------
for i=drange(1:100)
P=101;
result1=zeros(100);
result1(i)=interp2(Pressure,temperature,density,P,temperature(i));
disp(result1(i))
end
--------------------------------------------------------------------------------------------------------------------------
Error using griddedInterpolant
Interpolation requires at least two sample points for each grid dimension.
Error in interp2 (line 126)
F = makegriddedinterp({X, Y}, V, method,extrap);
how to slove this griddedInterpolantion error?

댓글 수: 2

Chunru
Chunru 2021년 12월 13일
The sizes of data points are not compatible:
size of Pressure=82*1, temperature=1*601, density=600*81
density should be 601*82
Kinjal Vijaybhai Deputy
Kinjal Vijaybhai Deputy 2021년 12월 13일
편집: Kinjal Vijaybhai Deputy 2021년 12월 13일
Thank you so much, it worked.

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

답변 (1개)

KSSV
KSSV 2021년 12월 13일

0 개 추천

You need to transpose the density matrix:
for i=drange(1:100)
P=101;
result1=zeros(100);
result1(i)=interp2(Pressure,temperature,density',P,temperature(i));
disp(result1(i))
end

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 12월 13일

편집:

2021년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by