How to create a random input with Butterworth band filter and specific PSD

2 views (last 30 days)
Hello,
I am currently attempting to create a random time input for vibration that is in accordance with a given PSD chart. I am attempting to limit this chart based on a given high-pass and low-pass frequency using a Butterworth band pass filter. I have quite a few problems, but my biggest issue is that, after I've created by Butterworth filter, I don't know how to create my random time input and then take a reliable PSD of it. Here is what I have so far:
if true
t=180; %Experiment time
Fs=200; %Sample frequency
N=t*Fs; %Total number of points to be generated
GPmax = 5.18; %max PSD
f1=0.89;
f2=11.22;
f3=2.0;
f4=2.7;
H=fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2',f1,f3,f4,f2,50,0.5,50,Fs);
D = design(H,'butter');
y=filter(D,GPmax*wgn(N,1,GPmax));
h = spectrum.welch;
Hpsd = psd(h,y,'Fs',Fs);
plot(Hpsd);
end
How can I use this Butterworth to create my random time input? I feel like wgn may not be getting the job done, else my welch PSD isn't an accurate representation of my PSD.
Thanks in advance for any help!

Answers (0)

Community Treasure Hunt

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

Start Hunting!