How to lengthen a boxcar filter?

9 ビュー (過去 30 日間)
Maria Amr
Maria Amr 2021 年 6 月 28 日
コメント済み: Yazan 2021 年 7 月 1 日
Hello eveyone, I appreciated any help.
I have applied a first difference filter and a boxcar(rect filter) to my signal but it is not working. I should lengthen the spikes so as to smooth the original signal. For example, instead of (1,-1) I should apply something like (.2,.2,.2,.2,.2,-.2,-.2,-2.,-.2,-.2). Would you please direct me how should design it? Thank you in advance!
My previous code are:
% Boxcar Filter
Ts = 0.0006096; % sampling interval
T = 1; % Time 1 Sec ,
fs=1/Ts; % sampling frequency
N=4701; % 1/2 f
t=-N*Ts:Ts:(N-1)*Ts; % boxcar length
x1 = rectpuls(t, T);
and for First difference filter is:
y = filter([1,-1],1,x); % x is my signal
  2 件のコメント
Dmitry Kaplan
Dmitry Kaplan 2021 年 7 月 1 日
Yazan
Yazan 2021 年 7 月 1 日
Why don't you just linearly interpolate, then introduces losses in the amplitude?
loss = 0.2;
y = loss * interp1([t(1), t(2)], [1 -1], t);

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Generation and Preprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by