Hi, Could you please help me generate a white noise (or any kind of noise) with a given minimum and maximum frequency. (say f_low = 891 Hz and f_high = 1122).. with fs=96k. I am basically trying to produce (white) noise for each 3rd octave band.

8 Ansichten (letzte 30 Tage)
I gather that you can't generate a simple white noise with these specs and that the idea would be to generate a white noise and apply a filter to it? To test the 1000 hz center frequency (for example), i would like to test a white noise with 891hz as the lowest frequency and 1122 as the highest. What filter would be best? I have tried using the 'fdesign.bandpass' filter.. but with no real success. Any help would be much appreciated, thanks!

Akzeptierte Antwort

Star Strider
Star Strider am 9 Feb. 2017
Bearbeitet: Star Strider am 9 Feb. 2017
A simple FIR filter will probably do what you want. The ‘fcuts’ vector is the vector of stopband and passband edges, so [low_stop low_pass high_pass high_stop]. Sharper cutoffs (less distance between the respective stopband and passband frequencies) create longer filters. If this filter is too long, decrease ‘low_stop’ and increase high_stop until it works with your signal. It is best to make the differences the same on both ends of the filter, but there is no absolute requirement.
Fs = 96E+3; % Sampling Frequency (Hz)
fcuts = [850 891 1122 1163]; % Frequency Vector (Hz)
mags = [0 1 0]; % Magnitude (Defines Passbands & Stopbands)
devs = [0.05 0.01 0.05]; % Allowable Deviations
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs);
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale');
figure(1)
freqz(hh, 1, 2^16, Fs)
set(subplot(2,1,1), 'XLim', [0 1500]) % Set Frequency Axis To Show 0-1500 Hz
set(subplot(2,1,2), 'XLim', [0 1500]) % Set Frequency Axis To Show 0-1500 Hz
s = randn(1, 1E+5); % Gaussian White Noise
t = 0 : 1/Fs : (length(s)-1)/Fs;
sfilt = filtfilt(hh, 1, s); % Filter Signal
figure(2)
subplot(2,1,1)
plot(t, s)
grid
title('Raw Signal')
subplot(2,1,2)
plot(t, sfilt)
grid
title('Filtered Signal')
An alternative IIR design (that will likely produce a shorter filter with similar characteristics) would be a Chebyshev Type II filter. The designfilt function makes that process straightforward.

Weitere Antworten (0)

Kategorien

Mehr zu Digital and Analog Filters finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by