Interpolation on same number of samples after FIR filtration

조회 수: 2 (최근 30일)
Lukas Poviser
Lukas Poviser 2022년 5월 3일
댓글: Star Strider 2022년 5월 3일
Hi,
I have made FIR filtration of my signal (sampled 25 Hz, 4500 samples) and after filtration that signal has about 200 samples less. The original signal is synced with another signal. And I need these two signals to work together and have same number of samples. What is best solution? How to interpolate filtrated signal to the same number of samples like before?

채택된 답변

Star Strider
Star Strider 2022년 5월 3일
Filtering should not change the signal length.
I am not certain exactly what you are doing, how your designed your FIR filter, or what your signal is.
I always suggest using the filtfilt function to do the actual filtering.
  댓글 수: 1
Star Strider
Star Strider 2022년 5월 3일
That is my filter. Before filtration the signal has 4538 samples and after it has just 4477 samples.
I cannot reproduce that behaviour —
y2 = randn(1,4538);
fs = 25;
fc = 0.65; % cut off frequency
Nfir = 124; % order of filter
N = length(y2);
wc=fc/(fs/2);
fil=fir1(Nfir,wc); % Filter design
filt_y_fir = filter(fil,1,y2); % filtering
filtered_signal_size = size(filt_y_fir)
filtered_signal_size = 1×2
1 4538
filt_y_fir = filtfilt(fil,1,y2); % filtering
filtered_signal_size = size(filt_y_fir)
filtered_signal_size = 1×2
1 4538
figure
freqz(fil,1,2^16,fs)
.

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

추가 답변 (1개)

Lukas Poviser
Lukas Poviser 2022년 5월 3일
% y2 is vector with original data
fs = 25;
fc = 0.65; % cut off frequency
Nfir = 124; % order of filter
N = length(y2);
wc=fc/(fs/2);
fil=fir1(Nfir,wc); % Filter design
filt_y_fir = filter(fil,1,y2); % filtering
delay = mean(grpdelay(fil)); % removing time shift
tt = tt(1:end-delay);
sn = y2(1:end-delay);
sf = filt_y_fir;
sf(1:delay) = [];
That is my filter. Before filtration the signal has 4538 samples and after it has just 4477 samples.

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by