how to do convolution of two arrays in 3d?
2 views (last 30 days)
Show older comments
hi everyone
i am trying to do convolution between a 371x391x23 and 371x391x23 array. however when i used convn, the output which i got had only Nan values in it. one of the input array has some Nan values in it. is it because of that the output also became Nan? kindly help me to solve it.
0 Comments
Answers (2)
Walter Roberson
on 27 Dec 2021
Yes, a single nan can pollute more than 95% of the output of a matrix with those dimensions, if it happens to be at the center of the array.
There is pretty much no point is doing a convolution with nan values present
2 Comments
Walter Roberson
on 27 Dec 2021
No. If you look at the formula at https://www.mathworks.com/help/matlab/ref/convn.html#bvg3kvh-9 then note that every A value is involved in the computation so if one of them is nan then at least one individual multiplication gives a nan result. But there is the summation over all of the values, and so nan is certain to be involved somewhere in the summation, so you are going to get nan as the result for all locations (except perhaps at some border locations.)
See Also
Categories
Find more on Matrix Indexing 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!