How to generate random broadband vibration signal for certain frequency range ?
62 views (last 30 days)
Show older comments
Hi,
How to generate random vibration signal for frequency range 0.5hz to 100Hz at 0.4 rms magnitude?
Thanks
0 Comments
Accepted Answer
Star Strider
on 12 Apr 2022
The usual approach is to generate a random signal (using either rand or randn) and then filter it —
Fs = 500; % Sampling Frequency (Hz)
t = linspace(0, 10, Fs*10)/Fs; % Time Vector
sv = randn(size(t)); % Input
vs = lowpass(sv, 100, Fs, 'ImpulseResponse','iir'); % Initial Vibration Signal
vs = highpass(vs, 0.5, Fs, 'ImpulseResponse','iir'); % Initial Vibration Signal
RMSvs = rms(vs); % RMS Of Generated & Filtered Signal
vs = vs * 0.4/RMSvs; % Scaled Result
Check = rms(vs) % Check Result
figure
plot(t, vs)
grid
xlabel('Time')
ylabel('Amplitude')
L = numel(t);
Fn = Fs/2;
NFFT = 2^nextpow2(L);
FTvs = fft(vs,NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTvs(Iv))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
Creating a bandpass filter with such a low first cutoff frequency creates a filter with undesirable results. The cascaded lowpass-highpass filter approach works.
.
4 Comments
More Answers (1)
Mathieu NOE
on 12 Apr 2022
hello
here you are my friend !
Fs = 500; % sampling rate
duration = 10; % seconds
rms_amplitude = 0.4;
samples = Fs*duration;
% time vector
dt = 1/Fs;
time = (0:samples-1)'*dt;
signal = randn(samples,1);
%% band pass filter section %%%%%%
f_low = 0.5; % Hz
f_high = 100; % Hz
N_bpf = 4; % order
[b,a] = butter(N_bpf,2/Fs*[f_low f_high]);
signal = filter(b,a,signal);
% check rms value and correct it if needed
signal_rms = sqrt(mean(signal.^2)) % NOK
cor_factor = rms_amplitude/signal_rms;
signal = signal.*cor_factor;
signal_rms = sqrt(mean(signal.^2)) % OK
plot(time,signal,'b');
See Also
Categories
Find more on Vibration Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!