Hello,
I have to design bandpass filter of 2-5kHz band, filter length 100. Then I have to filter with it the white noise and one other signal (triangle, sawtooth, square, f=500Hz).
Previously I designed a low pass filter and filter through it white noise (code below), I wonder if I could modify the code to fit the band pass or should I design it other way. Maybe filter designer? But how to later filter with it the signals? Please help me, I'm struggling with Matlab 🙁
rng defaultFs = 1000;t = linspace(0,1,Fs);x = randn(size(t));fc = 150;Wn = (2/Fs)*fc;b = fir1(20,Wn,'low',kaiser(21,3));fvtool(b,1,'Fs',Fs)y = filter(b,1,x);plot(t,x,t,y)xlim([0 0.1])xlabel('Time (s)')ylabel('Amplitude')legend('Original Signal','Filtered Data')
Best Answer