How generating band limited white noise with matlab

99 ビュー (過去 30 日間)
Randy82
Randy82 2013 年 6 月 30 日
In matlab I use if true % code randn(1,length(N)) end to generate white noise... Now I would like to generate band limited white noise (e. g. from 240 to 435 Hz). How must I code that in matlab!?

採用された回答

Wayne King
Wayne King 2013 年 7 月 2 日
That's not a very good approximation to a bandpass filter between 240 and 435 Hz.
Look at your magnitude response:
fvtool(B,A,'Fs',2000)
If you're going to use the window method, can you up the order significantly?
Compare your filter to:
[B1,A1] = fir1(48,[fd fu]/fn);
fvtool(B1,A1,'Fs',2000)
Now you can do:
noise_limited = filter(B1,A1,white_noise);

その他の回答 (1 件)

Wayne King
Wayne King 2013 年 6 月 30 日
編集済み: Wayne King 2013 年 6 月 30 日
band limited white noise is not possible. White noise by definition has a flat power spectral density function.
You can generate a white noise sequence and then filter that sequence to generate a band-limited noise but that noise will not be white.
You do not tell us what the sampling frequency is, which is a critical piece of information to have in designing the filter (you cannot design the filter without it), but I'll assume 2,000 Hz in the following example.
d = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2', 150,240,435,550,60,0.5,60,2000);
Hd = design(d);
y = filter(Hd,randn(1000,1));
You can view the filter's magnitude response
fvtool(Hd)
I've also given you a minimum-order design with 60-dB of stopband attenuation. If you need less stopband attenuation, you can specify that, or if you wish to specify your filter with a certain order, you can also do that with fdesign.bandpass
  2 件のコメント
Randy82
Randy82 2013 年 7 月 2 日
Ok, there are a lot of parameters i need to design the filter... My sampling frequency is e.g.
fs = 2000;
What about to generate band limited noise in this way:
fn = 0.5*fs;
fd = 240;
fu = 435;
[B, A] = fir1(10,[fd fu]/fn);
noise_limited = filter(B, A, white_noise);
Randy82
Randy82 2013 年 7 月 2 日
That works better - thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSignal Processing Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by