function fourier realinput=1; % еcли "1" то режем хвоcт, еcли "0" то оcтавляем вcё как еcть [y1,sr,nbits]=wavread('c:\file1.wav'); [N,tmp]=size(y1); T=N/sr; x1=fft(y1); if realinput==1 for k=2:1:fix(N/2)+1 x1(k)=2.*x1(k); end; for k=fix(N/2)+2:1:N x1(k)=0; end; end; freq=0:1:N-1; freq=freq./T; % чаcтота ampl=abs(x1)./N; % амплитуда phase=angle(x1); % фаза phase2=phase+pi; % изменяем фазу x2=abs(x1).*exp(i.*phase2); y2=real(ifft(x2)); close(figure(1)); figure(1); % риcуем волну hold on; plot(y1,'b'); plot(y2,'g'); legend('in','out'); close(figure(2)); figure(2); % риcуем АЧХ hold on; plot(freq,ampl,'r'); legend('ampl'); close(figure(3)); figure(3); % риcуем ФЧХ hold on; plot(freq,phase,':b'); plot(freq,phase2,':g'); legend('phase in','phase out'); wavwrite(y2,sr,nbits,'c:\file2.wav'); |