# FIR1 basic question

조회 수: 4 (최근 30일)
Raviteja 2011년 10월 2일
clear all
clc
fm=100; % signal freq
fs=800; % sampling feq
fn=2*fm; %Nyquist rate
t=0:1/fs:0.1;
X = 2*sin(2*pi*fm*t) ;
% Here I created 100 hz sine wave
% addes some noise to it
Y=X+randn(1,length(X));
figure
plot(t,X)
hold on
plot(t,Y,'r')
% I need to have passband of the signal
% between 80Hz to 120 Hz
% So normalized frequencies are
fw1=fm/fn-0.1; % 80 Hz
fw2=fm/fn+0.1; % 120 Hz
% Coefficents for fir filter within passband
b = fir1(12,[fw1 fw2]);
figure
freqz(b,1,128)
% I convolved filter coefficients with noised signal
Filt_out=conv(b,Y);
figure
plot(Filt_out)
% Filtered Signal output
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Jan 2011년 10월 2일
Please explain the problem with any details. Do you get an error or does the results differ from your expectations?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Wayne King 2011년 10월 2일
Hi, One major problem that you have is that you do not define your normalized frequencies correctly. If you want a passband between [80, 120]
fp1 = (2*80)/fs;
fp2 = (2*120)/fs;
b = fir1(12,[fp1 fp2]);
Filt_out = filter(b,1,Y);
plot(t,X)
hold on
plot(t,Y,'r')
I would recommend designing your filter with fdesign.bandpass unless you have some compelling reason to use fir1

댓글을 달려면 로그인하십시오.

### 카테고리

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

### Community Treasure Hunt

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

Start Hunting!

Translated by