0

声門パルスのコードを取得しました。パラメーターを初期化してそれを実行しようとすると、単一のパルスが取得されます。しかし、シグナルに実装しようとすると、出力を取得できませんでした。次のようなエラーが発生します。

添え字代入次元の不一致

fs= 11025;
f0= 190;
N1=12;
N2=17;
T=1/f0;     %period in seconds
pulselength=floor(T*fs);    %length of one period of pulse
%select N1 and N2 for duty cycle
N2=floor(pulselength*N2);
N1=floor(N1*N2);
gn=zeros(1,N2);
%calculate pulse samples
for n=1:N1-1
    gn(n)=0.5*(1-cos(pi*(n-1)/N1));
end
for n=N1:N2
    gn(n)=cos(pi*(n-N1)/(N2-N1)/2);
end
gn=[gn zeros(1,(pulselength-N2))];
plot(gn);

コードを調べて、どこが間違っているのか教えてください。

4

1 に答える 1

1

あなたのスニペットはhttp://www.mattmontag.com/projects/speech/rosenberg.mからのものだと思います。N1およびN2を 0 ~ 1 の値に設定します。

ヘルプからrosenberg.m:

N2 is duty cycle of the pulse, from 0 to 1.
N1 is the duration of the glottal opening as a fraction of the total pulse, from 0 to 1.

N1 と N2 の値が異なるローゼンバーグ パルス

于 2016-11-13T00:48:12.183 に答える