필터 지우기
필터 지우기

Bandpass filtering with noise sequence

조회 수: 2 (최근 30일)
Reelz
Reelz 2016년 1월 29일
답변: Star Strider 2016년 1월 29일
Hi guys, I am trying to make a filtered noise sequence with a nonzero spectrum between f1 = 100 and f2 = 300 Hz. However, my following code is producing a frequency vs magnitude graph that starts at 450? Here is the graph and the code:
% speccos.m plot the spectrum of a cosine wave
f1=100;
f2=300;
time=2; % length of time
Ts=1/1000; % time interval between samples
x=randn(1,time/Ts); % generate noise signal
freqs=[ 0.2 0.3 0.4 0.5 0.55 0.6];
amps=[0 0 1 1 0 0];
b=firpm(100,freqs,amps); % BP filter
ylp=filter(b,1,x); % do the filtering
figure(1),plotspec(ylp,Ts) % plot the output spectrum

답변 (1개)

Star Strider
Star Strider 2016년 1월 29일
I don’t have the toolbox that includes the plotspec function, so I used freqz and redesigned your filter.
See if this does what you want:
f1=100;
f2=300;
time=2; % length of time
Ts=1/1000; % time interval between samples
x=randn(1,time/Ts); % generate noise signal
freqs=[ 0.0 0.2 0.3 0.5 0.6 1];
amps=[0 0 1 1 0 0];
b=firpm(100,freqs,amps); % BP filter
ylp=filter(b,1,x); % do the filtering
% figure(1),plotspec(ylp,Ts) % plot the output spectrum
figure(1)
freqz(b,1,1024,1/Ts) % Filter Bode Plot

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by