필터 지우기
필터 지우기

Error using svd Input to SVD must not contain NaN or Inf.

조회 수: 58 (최근 30일)
Yapo OBOUE
Yapo OBOUE 2019년 6월 26일
댓글: Suddhasattwa Das 2021년 4월 5일
Hello everyone, I meet a problem with my code. when I run this code below, I get this error :
Error using svd Input to SVD must not contain NaN or Inf.
Error in fxy_I2_5Ddamp_nx_ny>P_RD (line ....)
[U,S,V] = svd(din);
How do I solve this problem ? Thanks.
function [dout]=P_RD(din,N,K)
[U,S,V] = svd(din);
s = SoftTh(diag(S), 2);
j=1:N
S=diag(s);
for j=1:N
S(j,j)=S(j,j)*(1-S(N+1,N+1)^K/S(j,j)^K);
end
dout=U(:,1:N)*S(1:N,1:N)*(V(:,1:N)');
return
  댓글 수: 1
infinity
infinity 2019년 6월 26일
편집: infinity 2019년 6월 26일
Hello,
According to the error, it could be seen that the matrix "din" contain "NaN" or "Inf". To solve your problem, you need to check why do you have NaN or Inf in the matrix "din".

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

채택된 답변

Shashank Sharma
Shashank Sharma 2019년 6월 27일
편집: Shashank Sharma 2019년 6월 27일
Run any(any(isnan(din))) and any(any(isinf(din))). If the output is 1 it means your matrix din has an infinity value or a not a number value. This is causing the svd function to error out.
  댓글 수: 2
MatLabMcLovinPotato
MatLabMcLovinPotato 2021년 1월 17일
I was able to create a sset sys, went to make it again with the same data and got this error about the NaN and Inf. I tried your suggestion (thank you!) and have 0 for both NaN and Inf. Yet still getting the same error?
Suddhasattwa Das
Suddhasattwa Das 2021년 4월 5일
I dont get a numeric answer. I get
sparse logical
All zero sparse: 1×1

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by