How to solve the error "Gaussian membership function must have positive sigma value"
7 views (last 30 days)
Show older comments
I am getting this error, The code and the data set is attched. Note: The data set is huge therefore googledrive link is attached. Couldn't able to resolve the error. Also, is there any way to use different membership function while using Fuzzy Clustering Method (FCM). May be this can solve the issue.
Level=5;
[gcm_part1_coeff, gcm_part1_level]= wavedec(gcm_part1,Level,'db2');
[obs_part1_coeff, obs_part1_level]= wavedec(obs_part1,Level,'db2');
gcm_Approx1= appcoef(gcm_part1_coeff, gcm_part1_level,'db2');
obs_Approx1= appcoef(obs_part1_coeff, obs_part1_level,'db2');
option = genfisOptions("FCMClustering","NumClusters",2,"MaxNumIteration",200,"Verbose",0);
fis = genfis(gcm_Approx1,obs_Approx1,option);
opt = anfisOptions('InitialFIS',fis,'EpochNumber',60,'InitialStepSize',0.1, ...
'DisplayANFISInformation',0,'DisplayErrorValues',0,'DisplayStepSize',0, ...
'DisplayFinalResults',0);
fis2 = anfis([gcm_Approx1 obs_Approx1],opt);
Error using fismf/set.Parameters
Gaussian membership function must have positive sigma value.
Error in genfis3 (line 152)
mf(j).Parameters = computemfparams (mftype, Xin(:,i), U(j,:)', center(j,i));
Error in genfis (line 81)
fis = genfis3(Xin,Xout,option.FISType,option.NumClusters, ...
Error in Fuzzy_ANFIS (line 10)
fis = genfis(gcm_Approx1,obs_Approx1,option);
1 Comment
Answers (1)
Sam Chak
on 5 Aug 2023
The error indicates that either you or your algorithm made a mistake by assigning a negative value to the sigma (standard deviation) in the Gaussian function. It is impossible to have a negative standard deviation because the sigma represents a measure of the spread or dispersion of the data, and it should always be a non-negative value as shown in this formula:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1451102/image.png)
x = linspace(-1, 1, 20001);
sigma = 0.25; % standard deviation
mu = 0; % mean
y1 = gaussmf(x, [sigma mu]); % Gaussian MF
figure(1)
plot(x, y1, 'linewidth', 2), grid on, xlabel('x'),
y2 = gaussmf(x, [-sigma mu]); % Gaussian MF
0 Comments
See Also
Categories
Find more on Fuzzy Logic Toolbox 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!