Gaussian using fspecial('gaussian',h,s)
44 views (last 30 days)
I'm trying to generate a gaussian with fspecial but I keep on getting the same error:
Error in fspecial (line 8)
Does anybody know what is wrong?
Jyothis Gireesh on 7 Oct 2019
The “fspecial('gaussian',h,s)” returns a circularly symmetric gaussian function of size h*h. Since the value of h is updated in each iteration of the for loop, the size of the resulting matrix also changes accordingly. The variable “LG(i)” can only be assigned a scalar value since “LG” is declared as a 20*20 matrix of zeros. So the assignment may result in a size mismatch between the left and right sides.
It may also be better to replace the “fspecial()” function with “imgaussfilt()” function which offers the same functionality.
Please go through the following link to get further information on “imgaussfilt()”