How to solve the error "Gaussian membership function must have positive sigma value"
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Sam Chak
2023-8-5
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:
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!