필터 지우기
필터 지우기

problem with interp1

조회 수: 2 (최근 30일)
Stetson Spencer
Stetson Spencer 2018년 11월 27일
답변: Bruno Luong 2018년 11월 27일
Hi, for some reason when I try to use the interp1 function it gives me an error "Error using griddedInterpolant. The grid vectors must contain unique points."
but in my code I already accounted for that by doing the following:
dnew = unique([dlrg dmed dsml]);
plrg = interp1(log10(dlrg),plrg,log10(dnew),'linear','extrap');
why is it ignoring the fact that I told it to use unique points?
  댓글 수: 1
Adam Danz
Adam Danz 2018년 11월 27일
Perhaps your variables log10(dlrg),plrg do not have unique coordinates?

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

채택된 답변

Matt J
Matt J 2018년 11월 27일
It is dlrg that must contain unique points. There is no requirement for uniquness on dnew.

추가 답변 (2개)

Stephen
Stephen 2018년 11월 27일
Your definition of "dlrg" probably contains duplications. You aren't running unique on "dlrg" and that is the vector of values you are interpolating on. Also, you're assigning the variable name "plrg" to both the "Y" input and "yi" output of the function. That rarely ends well for me.

Bruno Luong
Bruno Luong 2018년 11월 27일
[x,i] = unique(log10(dlrg))
plrg = interp1(x,plrg(i),log10(dnew),'linear','extrap');

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by