Hi I have few questions. I want to play a white noise sound for 20 ms, but I am not sure how to check which frequencies are used to produce white noise. This is the code I am using: x=wgn(200,1,0); sound(x,10000)
But I don't think this is producing what I want. Also I have a doubt: the matrix x contains values from -3 to +3, but I don't see why. I would expect those to be the frequencies, but if I generate a white noise then the frequencies should range from 20 Hz to 20 kHz, right?

댓글 수: 7

KSSV
KSSV 2018년 7월 5일
A white noise has all possible frequencies. To achieve what you want....you need to generate white noise and filter out the unwanted frequencies.
Salvatore Lacava
Salvatore Lacava 2018년 7월 5일
when you say all possible frequencies do you mean limited to the specifactions of your speakers/computer? Or does white noise includes ultrasound and so on?
Wooshik Kim
Wooshik Kim 2018년 7월 5일
Also you can use fft to analyze the frequency spectrum of your noise
Salvatore Lacava
Salvatore Lacava 2018년 7월 6일
Hi, so if I apply fft on the matrix I get a bunch of negative values from -100 to +100. Those can't be frequency, so do you have an idea of what I am looking at, and how to visualize the frequencise used?
Aquatris
Aquatris 2018년 7월 6일
편집: Aquatris 2020년 10월 30일
Follow the example from Matlabs website for fft , where they explain how to take fft of a signal.
Salvatore Lacava
Salvatore Lacava 2018년 7월 7일
Your link is broken

댓글을 달려면 로그인하십시오.

답변 (1개)

Hengameh Noshahri
Hengameh Noshahri 2020년 10월 30일

2 개 추천

Fs = 96000; % sampling frequency in Hz
Ts = 1/Fs; % sampling time in seconds
te = 5; % signal duration in seconds
y = randn(te*Fs,1); % generate White noise of duration te
t = 0:Ts:te; % generate a time array
N = size(t,2); % size of the signal
N = pow2(nextpow2(N)); % change N for efficiency in FFt calculation
Freq = Fs/2 * linspace(0, 1, N/2+1); % generate a frequency array
Y = fft(y,N)*(N-1)*Ts/N; % calculate FFT of the signal
YMag = abs(Y); % magnitude of FFT signal
plot(Freq,YMag(1:N/2+1)), ylabel('FFT'), xlabel('Frequency [Hz]')
sound(y,Fs,24); % listen to the generated noise if you feel adventurous!

카테고리

도움말 센터File Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기

질문:

2018년 7월 5일

편집:

2020년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by