Very basic question about fir1 command

조회 수: 4 (최근 30일)
Pelin Kaya
Pelin Kaya 2022년 6월 30일
댓글: Star Strider 2022년 6월 30일
I'm all new to Matlab and everything including, i was taking some classes to learn matlab and signal processing and there was this question that my teacher asked during an exam and i still havent figured it out . She basically gave us a signal ;
t=0:1/500:0.3
n=cos(2*pi*10*t) + sin(2*pi*50*t);
and asked us to design a FIR filter with 32-order and then plot the signal. There's no other explanation, i'm assuming i should use fir1 command but i'm not sure how. If you guys help me, that'd really help.

채택된 답변

Star Strider
Star Strider 2022년 6월 30일
Probably something like this —
t=0:1/500:0.3;
n=cos(2*pi*10*t) + sin(2*pi*50*t);
Fs = 500;
Fn = Fs/2;
b = fir1(32, 25/Fn);
figure
freqz(b, 1, 2^16, Fs)
n_filt = filtfilt(b, 1, n);
figure
plot(t, n)
hold on
plot(t, n_filt)
hold off
grid
legend('Original Signal','Filtered Signal', 'Location','best')
Experiment with it!
.
  댓글 수: 2
Pelin Kaya
Pelin Kaya 2022년 6월 30일
Thanks, i'll!
Star Strider
Star Strider 2022년 6월 30일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by