필터 지우기
필터 지우기

Why my fft graph gives different output on again running the code?

조회 수: 3 (최근 30일)
y=audioread('speech.wav');
%sound(y);
subplot(2,3,1);
plot(y);
xlabel('Samples');
ylabel('Magnitude');
title('Original speech signal');
%adding noise
x=awgn(y,5);
z=y+x;
z=z/2;
%sound(z);
subplot(2,3,2);
plot(z);
xlabel('Samples');
ylabel('Magnitude');
title('Noise added to speech signal');
% framing
f_duration = 0.025;
fs=8000;
f_size = (f_duration.*fs);
n = length(y);
n_f = floor(n/f_size); %no. of frames
temp = 0;
fr=z(1 : f_size);
window=hamming(length(fr));
window_framing=fr.*window;
%Taking FFT
fft_sig=fft(window_framing,256);
abs_val=abs(fft_sig);
N=256;
w_axis=(2*pi*[0:N-1])/N;
subplot(2,3,3);
plot(w_axis,abs_val);
When I plot the graph of FFT, I always get different on running the again and again. Please tell me what's wrong in my code?

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 6월 21일
I suspect the reason it changes is because you are adding randon noise to your signal with awgn. Since that changes every time the code is run, the FFT result will look slightly different every time.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by