Very basic question about fir1 command

1 view (last 30 days)
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 ;
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.

Accepted Answer

Star Strider
Star Strider on 30 Jun 2022
Probably something like this —
n=cos(2*pi*10*t) + sin(2*pi*50*t);
Fs = 500;
Fn = Fs/2;
b = fir1(32, 25/Fn);
freqz(b, 1, 2^16, Fs)
n_filt = filtfilt(b, 1, n);
plot(t, n)
hold on
plot(t, n_filt)
hold off
legend('Original Signal','Filtered Signal', 'Location','best')
Experiment with it!
Star Strider
Star Strider on 30 Jun 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by