首页 文章

解释了simulink中的MATLAB功能块错误

提问于
浏览
0

我创建了simulink块,如下所示:

enter image description here

在解释的MATLAB函数中我使用此代码 .

function y1 = fcn(signal)
%% variable declaration
Fm = 100;%length of Frames excursion
framelnc = 100;%length of Frames excursion
Fn = 256;%length of Frames sampling frequency 12.500kHz, frame length 020.5ms
fs = 8000;

x=signal;

%% Preprocessing: Noise Removal
IS= 0.25; % initial silence (noise only)
output=denoise(x,fs,IS);
y = output;

%% Extraction of LFCC Features
feat = lfcc(y,fs);

%% Extract VQ CODE
k=16; % number of centroids required

code1 = vqext(feat, k);
test = mean2(code1);

%% Emotions Recognition 
load ('train.mat')

Class = knnclassify(test , feature, type);

if (Class == 1)
   %% Display identification results
   msg=1;
end

if (Class == 2)
   %% Display identification results
    msg=2;
end

y1 = msg;

我在单独的matlab文件中定义了这些 denoiselfccvqextknnclassify 函数 . 但我得到的错误如下 .

enter image description here

我怎么解决这个问题?

1 回答

  • 1

    在您的图片中,我们可以看到您的数据正式有两个维度[1024x1]!所以我认为,解释的MATLAB函数无法使用此数据类型 .

    所以我建议使用帧转换块 .

    附:顺便问一下,为什么要使用Interpreted功能?真的有必要吗?

    注意此块比Fcn块慢,因为它在每个集成步骤中调用MATLAB解析器 . 请考虑使用内置块(例如Fcn块或数学功能块) . 或者,您可以将函数编写为MATLAB S函数或MEX文件S函数,然后使用S函数块访问它 .

相关问题