模糊推理系统

发布于 2024-11-02 03:56:57 字数 524 浏览 0 评论 0原文

我试图通过使用 evalfis() 函数给出输入来使用 .fis 文件。我以以下形式提供输入:

        jo= myImage(2);   % jo contains the graysacle value of pixel at location 2         

        a=readfis('terrain_classification_fuzzy');
        Result = evalfis(jo,a);

但我收到以下错误:

???使用 ==> 时出错评估主义 第一个输入必须是定义的 DOUBLE 矩阵

==> 中的错误埃瓦尔菲斯 84 岁 [输出,IRR,ORR,ARR] = evalfismex(输入,fis,numofpoints);

错误==> see_movie_segmentationTry4_in Correct 位于 113 结果 = evalfis([jo],a);

请帮我解决这个问题...

I am trying to use a .fis file by giving an iput using evalfis() function. I am giving input in the form:

        jo= myImage(2);   % jo contains the graysacle value of pixel at location 2         

        a=readfis('terrain_classification_fuzzy');
        Result = evalfis(jo,a);

But i am getting the following error:

??? Error using ==> evalfismex
The first input must be a defined DOUBLE matrix

Error in ==> evalfis at 84
[output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);

Error in ==> see_movie_segmentationTry4_incorrect at 113
Result = evalfis([jo],a);

Kindly help me with this...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

剩余の解释 2024-11-09 03:56:58

检查此示例和参数,看看您是否有类似的参数:

function trn_2in(mf_n, epoch_n)    
% This script requires the Fuzzy Logic Toolbox from the MathWorks.
if nargin < 2, epoch_n = 100; end;    
if nargin < 1, mf_n = 4; end;    
% ====== collect training data    
point_n = 11;    
x = linspace(-10, 10, point_n);    
y = linspace(-10, 10, point_n);    
[xx, yy] = meshgrid(x, y);    
tmp1 = sin(xx)./(xx);    
index = find(isnan(tmp1)==1);    
tmp1(index) = ones(size(index));  
tmp2 = sin(yy)./(yy);    
index = find(isnan(tmp2)==1);    
tmp2(index) = ones(size(index));  
zz = tmp1.*tmp2;    
trn_data = [xx(:) yy(:) zz(:)];       
% ====== training options    
ss = 0.1;    
ss_dec_rate = 0.9;    
ss_inc_rate = 1.1;
mf_type = 'gbellmf';
% ====== generate the initial FIS     
in_fismat = genfis1(trn_data, mf_n, mf_type);
% ====== start training    
[trn_out_fismat trn_error step_size] = ...    
    anfis(trn_data, in_fismat, [epoch_n nan ss ss_dec_rate ss_inc_rate]);    
% ====== compute ANFIS output     
z_hat = evalfis([xx(:) yy(:)], trn_out_fismat);  
% ====== plot of training data
genfig('training data');    
subplot(221);    
mesh(xx, yy, zz);    
limit = [min(xx(:)) max(xx(:)) min(yy(:)) max(yy(:)) ...    
    min(zz(:)) max(zz(:))];
    axis(limit); set(gca, 'box', 'on');    
xlabel('X'); ylabel('Y'); title('Training data');    
    zz_hat = evalfis([xx(:) yy(:)], trn_out_fismat);    
subplot(222);    
mesh(xx, yy, reshape(zz_hat, point_n, point_n));    
axis(limit); set(gca, 'box', 'on');    
xlabel('X'); ylabel('Y'); title('ANFIS Output');    
subplot(223)    
plot(1:epoch_n, trn_error);
xlabel('epoch number'); ylabel('root mean squared error');    
title('error curve');
subplot(224)    
plot(1:epoch_n, step_size);    
xlabel('epoch number'); ylabel('step size');    
title('step size curve');    
% ====== plot MFs    
figH = genfig('MFs for SINC function training');    
% plot initial MFs on x and y    
subplot(221); plotmf(in_fismat, 'input', 1);    
subplot(222); plotmf(in_fismat, 'input', 2);    
subplot(223); plotmf(trn_out_fismat, 'input', 1);
subplot(224); plotmf(trn_out_fismat, 'input', 2);    
delete(findobj(figH, 'type', 'text'));    
subplot(221); title('Initial MFs on X');    
subplot(222); title('Initial MFs on Y');    
subplot(223); title('Final MFs on X');    
subplot(224); title('Final MFs on Y');

check this example, and the parameters to see if You have similar parameters:

function trn_2in(mf_n, epoch_n)    
% This script requires the Fuzzy Logic Toolbox from the MathWorks.
if nargin < 2, epoch_n = 100; end;    
if nargin < 1, mf_n = 4; end;    
% ====== collect training data    
point_n = 11;    
x = linspace(-10, 10, point_n);    
y = linspace(-10, 10, point_n);    
[xx, yy] = meshgrid(x, y);    
tmp1 = sin(xx)./(xx);    
index = find(isnan(tmp1)==1);    
tmp1(index) = ones(size(index));  
tmp2 = sin(yy)./(yy);    
index = find(isnan(tmp2)==1);    
tmp2(index) = ones(size(index));  
zz = tmp1.*tmp2;    
trn_data = [xx(:) yy(:) zz(:)];       
% ====== training options    
ss = 0.1;    
ss_dec_rate = 0.9;    
ss_inc_rate = 1.1;
mf_type = 'gbellmf';
% ====== generate the initial FIS     
in_fismat = genfis1(trn_data, mf_n, mf_type);
% ====== start training    
[trn_out_fismat trn_error step_size] = ...    
    anfis(trn_data, in_fismat, [epoch_n nan ss ss_dec_rate ss_inc_rate]);    
% ====== compute ANFIS output     
z_hat = evalfis([xx(:) yy(:)], trn_out_fismat);  
% ====== plot of training data
genfig('training data');    
subplot(221);    
mesh(xx, yy, zz);    
limit = [min(xx(:)) max(xx(:)) min(yy(:)) max(yy(:)) ...    
    min(zz(:)) max(zz(:))];
    axis(limit); set(gca, 'box', 'on');    
xlabel('X'); ylabel('Y'); title('Training data');    
    zz_hat = evalfis([xx(:) yy(:)], trn_out_fismat);    
subplot(222);    
mesh(xx, yy, reshape(zz_hat, point_n, point_n));    
axis(limit); set(gca, 'box', 'on');    
xlabel('X'); ylabel('Y'); title('ANFIS Output');    
subplot(223)    
plot(1:epoch_n, trn_error);
xlabel('epoch number'); ylabel('root mean squared error');    
title('error curve');
subplot(224)    
plot(1:epoch_n, step_size);    
xlabel('epoch number'); ylabel('step size');    
title('step size curve');    
% ====== plot MFs    
figH = genfig('MFs for SINC function training');    
% plot initial MFs on x and y    
subplot(221); plotmf(in_fismat, 'input', 1);    
subplot(222); plotmf(in_fismat, 'input', 2);    
subplot(223); plotmf(trn_out_fismat, 'input', 1);
subplot(224); plotmf(trn_out_fismat, 'input', 2);    
delete(findobj(figH, 'type', 'text'));    
subplot(221); title('Initial MFs on X');    
subplot(222); title('Initial MFs on Y');    
subplot(223); title('Final MFs on X');    
subplot(224); title('Final MFs on Y');
罪歌 2024-11-09 03:56:58

我发现了错误。只是“jo”最初设置为 int8 而不是 double 类型。

I found the error. It was just that "jo" was initally set to int8 and not of type double..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文