-1

だから私は次のコードを書き、次のようなエラーが発生しました:

Error using ==> times
Matrix dimensions must agree.
Error in ==> Untitled2 at 28
edges =ifft(fft(song).*fft(myFilter));

これは私が使用したコードです:

[song,FS] = wavread('c scale fast.wav');
P     = 20000/44100*FS;                   % length of filter 
N     = length(song);                     % length of song
t     = 0:1/FS:(length(song)-1)/FS;       % and get sampling frequency
song      = song/max(abs(song));

% Gaussian Filter
x    = linspace( -1, 1, N); % create a vector of N values between -1 and 1 inclusive
sigma    = 0.335; % standard deviation used in Gaussian formula
myFilter = -x .* exp( -(x.^2)/(2*sigma.^2));% compute first derivative
myFilter = myFilter / sum( abs( myFilter ) ); % normalize

% fft convolution
song     = song(:);
myFilter = myFilter(:);
song(length(song)+length(myFilter)-1) = 0;
myFilter(length(song)+length(myFilter)-1) = 0;
edges    = ifft(fft(song).*fft(myFilter));
tedges   = edges(P/2:N+P/2-1);         % shift by P/2 so peaks line up w/ edges
tedges   = tedges/max(abs(tedges));    % normalize

誰かがここで何が悪いのか教えてもらえますか??

4

1 に答える 1