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.

8 views (last 30 days)
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
yden = wdenoise(mv1,6);

Answers (1)

Arthi Sathyamurthi
Arthi Sathyamurthi on 29 Dec 2021
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.


Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by