MATLAB: Purpose of ceil in fspecial


These are few lines from a code:
I need to know that what is the purpose of ceil in fspecial? What is it going to do?

Best Answer

  • They wanted to specify s, and the second arg must be an integer. They could have done int32(4*s) or floor(4*s) but for whatever reason they chose ceil. They wanted it to be at least as wide as 4 std dev's with the requirement that it be an integer because it's a window size in pixels. As you can find in the help for ceil(), it rounds up to the next highest integer value.