Come posso risolvere il seguente problema: Error using matlab.int​ernal.math​.interp1 Interpolation requires at least two sample points for each grid dimension.

2 ビュー (過去 30 日間)
Salve a tutti! Ho scaricato il package di Wei Hu e Bing Si sulla Partial Wavelet Coherency e l'ho combinato con quello di Grinstend.
Appena runno, non ottengo il risultato in quanto spunta:
"Error using matlab.internal.math.interp1
Interpolation requires at least two sample points for each grid dimension.
Error in interp1 (line 154)
VqLite = matlab.internal.math.interp1(X,V,method,method,Xqcol);
Error in pwcsignif (line 308)
sig95(s)=interp1(ptile,rsqy,.95);
Error in pwc (line 349)
pwcsig=pwcsignif(Args.MonteCarloCount,Args.AR1,dt1,length(t)*2,Args.Pad,Args.Dj,Args.S0,Args.J1,Args.Mother,.6);"
Ho provato a risolvere ma senza risultati!! Potreste aiutarmi per favore.
1) error in interp1 (line 154)
if (num_vals > 1)
Xext = {cast(X,'double'),(1:num_vals)'};
VqLite = matlab.internal.math.interp2(Xext,V,method,method,...
{cast(Xqcol,class(Xext{1})),Xext{2:end}});
else
VqLite = matlab.internal.math.interp1(X,V,method,method,Xqcol);
end
2)Error in pwcsignif (line 308)
for s=1:maxscale
rsqy=((1:nbins)-.5)/nbins;
ptile=wlc(s,:);
idx=find(ptile~=0);
ptile=ptile(idx);
rsqy=rsqy(idx);
ptile=cumsum(ptile);
ptile=(ptile-.5)/ptile(end);
sig95(s)=interp1(ptile,rsqy,.95);
end
3)Error in pwc (line 349)
if (nargout>0)||(Args.MakeFigure)
pwcsig=pwcsignif(Args.MonteCarloCount,Args.AR1,dt1,length(t)*2,Args.Pad,Args.Dj,Args.S0,Args.J1,Args.Mother,.6);
pwcsig=(pwcsig(:,2))*(ones(1,n));
pwcsig=Rsq./pwcsig;
end
Aspetto vostre notizie. Grazie della disponibilità!
P.S! Ho provato invano sia con la versione 2020a, 2021a, 2022a.

回答 (1 件)

Tushar Sharma
Tushar Sharma 2024 年 2 月 5 日
Hi Giuseppe,
The error which you are facing indicates a problem with the input data provided for interpolation.
You may use MATLAB's debugging tools to set breakpoints at the lines where errors occur (lines 154, 308, 349). Inspect the variables 'X', 'V', 'ptile', 'rsqy', and 'Xqcol' to see if they contain the expected data.
The possible reasons for this error could be:
  • Insufficient Data Points
  • Empty or Single Data Point
  • Non-monotonic X Vector
  • Incorrectly Sized Inputs
  • Data Type Mismatch
  • NaN or Inf Values
To resolve the issue, you should check your data to ensure that:
  • You have at least two distinct data points in X.
  • The X vector is sorted in ascending or descending order without any duplicates.
  • There are no NaN or Inf values in your data.
  • The data types and sizes of X, V, and Xq are appropriate and compatible for interpolation.
Also, please refer to the following documentation to know more about 'interp1' function:
Hope it helps!
  2 件のコメント
Giuseppe
Giuseppe 2024 年 2 月 5 日
Grazie per avermi risposto! Non sono i dati il problema: anche se provo l'esempio fatto dagli autori, Matlab presenta gli stessi errori.
Steven Lord
Steven Lord 2024 年 2 月 5 日
Google translation: "Thank you for answering me! The data is not the problem: even if I try the example given by the authors, Matlab presents the same errors."

サインインしてコメントする。

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!