帮忙看看 MATLAB 程序

来源:百度知道 编辑:UC知道 时间:2024/05/06 00:12:35
function M3 = blockFrames(s, fs, m, n)
% blockFrames: Puts the signal into frames
%
% Inputs: s contains the signal to analize
% fs is the sampling rate of the signal
% m is the distance between the beginnings of two frames
% n is the number of samples per frame
%
% Output: M3 is a matrix containing all the frames
%
%
%%%%%%%%%%%%%%%%%%
% Mini-Project: An automatic speaker recognition system
%
% Responsible: Vladan Velisavljevic
% Authors: Christian Cornaz
% Urs Hunkeler
l = length(s);
nbFrame = floor((l - n) / m) + 1;
for i = 1:n
for j = 1:nbFrame
M(i, j) = s(((j - 1) * m) + i);
end
end
h = hamming(n);
M2 = diag(h) * M;
for i = 1:nbFrame
M3(:, i) = fft(M2(:, i));
end
大家帮看看 这段程序是什么意思啊?而且运行还提示这样的错误:
??? Input argument "s" is undefined.

Error in ==> blockFrames at 18
l = length(s);
谢谢各位了

我是个菜鸟 我不知道还对哦
这里的s是由其他函数调用这个 blockFrames 函数时输入的参数。
现在你单独运行这个 blockFrames 时 ,s肯定就是没有定义的咯
所以如果你要单独运行这个程序 就要在开始时定义s 比如在
function M3 = blockFrames(s, fs, m, n)下面加入
s=rand(4);
同理也需要定义fs, m, n
你这个似乎是语音识别系统中的一部分函数,s是输入信号 m n fs是相应参数
你可以自己写个程序,然后给定这些参数,在调用这个blockFrames就行了