yomican 发表于 2007-5-21 22:41

请教这个程序

已有程序如下:
function =pvSimilarity(cPitch, tPitch, pitchTol, plotOpt)
% pvSimilarity: Similarity between two pitch vectors

if nargin<1, selfdemo; return; end
if nargin<4, plotOpt=0; end

cPitch=cPitch(:);
tPitch=tPitch(:);
absDiff=abs(cPitch-tPitch);
nonZeroIndex=(cPitch~=0) & (tPitch~=0);
outOfBoundIndex=absDiff>pitchTol;
errorIndex=nonZeroIndex & outOfBoundIndex;
errorCount=sum(errorIndex);
absAveError=mean(absDiff(nonZeroIndex));
pitchCount=sum(nonZeroIndex);
correctCount=pitchCount-errorCount;
recogRate=correctCount/pitchCount;

if plotOpt
        pitchNum=length(tPitch);
        tPitch(tPitch==0)=nan;
        plot(1:pitchNum, cPitch, 'o-g', 1:pitchNum, tPitch, '.-k');
        index=find(errorIndex);
        line(index, cPitch(index), 'marker', 'x', 'linestyle', 'none', 'color', 'r');
        grid on;
        legend('Computed pitch', 'Target pitch');
        xlabel(sprintf('recogRate=%g%%, pitchTol=%g, correctCount=%d, pitchCount=%d', recogRate*100, pitchTol, correctCount, pitchCount));
end

% ====== Self demo
function selfdemo
cPitch=;
tPitch=;
pitchTol=1;
plotOpt=1;
feval(mfilename, cPitch, tPitch, pitchTol, plotOpt);
有没有好心人能帮忙解释一下这个程序,小女子在此谢谢了!

studyboy 发表于 2007-5-22 16:19

解释程序,也要说哪个地方不懂啊? 不会是……………………

yomican 发表于 2007-5-23 10:04

就是大概流程是怎样的?我实在是看不懂,只要好心人大概说下,我也比较好研究下去啊,不好意思本人比较笨,总是要有人引导..

eight 发表于 2007-5-23 10:17

原帖由 yomican 于 2007-5-23 10:04 发表 http://www.chinavib.com/forum/images/common/back.gif
就是大概流程是怎样的?我实在是看不懂,只要好心人大概说下,我也比较好研究下去啊,不好意思本人比较笨,总是要有人引导..

笨不会是永远,聪明也不会是必然,每个人都经历过这个阶段,况且,对于别人的代码来说,任何人都是头痛的,也不会有太多的精力
页: [1]
查看完整版本: 请教这个程序