How to solve the error "Gaussian membership function must have positive sigma value"

조회 수: 7 (최근 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);
  댓글 수: 3
mehmet
mehmet 2025년 2월 22일
While I have no problems using Matlab 2017, I also get the same error messages when using the same codes in version 2023a. How can we solve this problem caused by the version difference? Any help?
Sam Chak
Sam Chak 2025년 2월 23일
@mehmet, can you post your test data and code in a new question?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam Chak
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
Error using fuzzy.internal.utility.validateGaussMFParameterValues
Gaussian membership function must have positive sigma value.

Error in gaussmf (line 35)
fuzzy.internal.utility.validateGaussMFParameterValues(params)

카테고리

Help CenterFile Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by