band limited white noise

42 views (last 30 days)
Shz713
Shz713 on 15 Dec 2015
Commented: Star Strider on 16 Dec 2015
I need to make random excitation and I usually do that by "randn" command. However, I have to make random excitation with broadband frequency components, namely to excite certain frequencies. Let's say my sampling frequency (fs) is 50Hz and I need to have random white noise in range of 0 to 8 Hz to make sure this range is adequately excited.
I appreciate if someone gives me a simple way to do that which could be applied to general cases.
Cheers

Accepted Answer

Star Strider
Star Strider on 15 Dec 2015
Create a lowpass filter with the appropriate passband and then use the filtfilt function to filter your noise signal. The output should be band-limited noise that matches your specifications. If you need help in designing and implementing your filter, my filter design procedure is here: How to design a lowpass filter for ocean wave data in Matlab?
See if this works for you:
Fs = 5E+4; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Fco = 8; % Cutoff Frequency (Hz)
Wp = Fco/Fn; % Normalised Cutoff Frequency (rad)
Ws = 1.6*Wp; % Stopband Frequency (rad)
Rp = 3; % Passband Ripple (dB)
Rs = 20; % Stopband Ripple (dB)
[n,Wn] = buttord(Wp,Ws,Rp,Rs); % Calculate Filter Order
[b,a] = butter(n,Wn); % Calculate Filter Coefficients
[sos,g] = tf2sos(b,a); % Convert To Second Order Section Representation
figure(1)
freqz(sos, 1024, Fs) % Plot Filter Response (Bode Plot)
L = 1E+6; % Signal Length
noise = randn(1, L); % White Noise
filtered_noise = filtfilt(sos,g,noise); % Band-Limited Noise
FTfn = fft(filtered_noise)/L; % Fourier Transform Of Filtered Signal
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(2)
plot(Fv, abs(FTfn(Iv)))
axis([0 50 ylim])
grid
title('Band-Limited Noise')
xlabel('Frequency (Hz)')
ylabel('Amplitude')
  7 Comments
Shz713
Shz713 on 16 Dec 2015
Heaps of thanks and Merry Xmas
Peace
Star Strider
Star Strider on 16 Dec 2015
As always, my pleasure. You, too.
Definitely Peace!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!