I am trying to apply wdenoise function over a 1-D array but I'm getting an error as ' Expected X to be finite ' error message ? How to fix this error.

조회 수: 5(최근 30일)
Anand Ambardekar
Anand Ambardekar 2021년 11월 22일
답변: Arthi Sathyamurthi 2021년 12월 29일
In the following code when mv1 is inserted within wdenoise function I am getting the above mentioned error.
load sigin.mat;
load ADBefMonopolarF3A1.mat;
a = AmodMREFCZ(1,:);
%b = AmodMREFCZ(2,:);
SigTr = F3A1' ;
sigin1 = SigTr(80001:82560);
time1 = a(75001:77560);
mv1 = movavg(sigin1,'linear',1);
chefiltop = filter(Butter1,mv1); % mv1 is moving average output of original signal sigin1 which is 1* 2560 array
plot(time1,mv1);
yden = wdenoise(mv1,6);

답변(1개)

Arthi Sathyamurthi
Arthi Sathyamurthi 2021년 12월 29일
Hello Anand,
Since, the "sigin.mat" and "ADBefMonopolarF3A1.mat" were not attached I was not able to run the program attached. But the error "Expected X to be finite" results when the input (in your case mv1) to wdenoise function is not finite. Kindly check for any "NaN" or "inf" values in the mv1 variable and replace those values as necessary. You can use the isfinite function to check if the input is finite. You can refer to this link to know the list of elements recognized as finite.

Community Treasure Hunt

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

Start Hunting!

Translated by