How can I Up sample and Filtering a basic sinc function with FIR filter?

I am learning Matlab in preperation for a graduate program in the fall. I have picked a basic function that showed the plot in the time domain than took the FFT to show in the frequency doman. Following this I attempted to up sample the signal in the time domain by adding a 0 every other point. Pass it through a lowpass FIR filter to fill these zeros in with real values while at the same time removing the duplicate signals. I understand these signals are periodic. The point of my attempt was to focus on a specific part of the signal. All of this to better understand digital interpolation.
I may be misunderstanding what the professor is asking me so I hope this makes sense.
My Code:
Fs = 1000;
T_inc = 1/Fs;
T_measure = 1;
L1=T_measure/T_inc;
t = 0:T_inc:T_measure;
S = 1+4*cos(2*2*pi*10*t) + 2*cos(4*2*pi*10*t);
b = fir1(10,[0.079 0.081], 'low');
L = length(S);
signal_FFT = fft(S,L)/L;
amplitude = 2*abs(signal_FFT(1:L/2+1));
Frequency = Fs/2*linspace(0,1,L/2+1);
subplot(4,1,2)
plot(Frequency,amplitude);
subplot(4,1,1)
plot(t,S);
M = upsample(S,2);
R = filter(b,1,M);
r = length(R);
t2 = linspace(0,1,r);
subplot(4,1,3);
plot(t2,R);
FFT2 = fft(M,r)/r;
amplitude2 = 2*abs(FFT2(1:r/2+1));
Frequency3 = Fs/2*linspace(0,1,r/2+1);
subplot(4,1,4)
plot(Frequency3,amplitude2);

回答 (0 件)

カテゴリ

タグ

質問済み:

2020 年 8 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by