필터 지우기
필터 지우기

strange output after using the Moving average filter

조회 수: 4 (최근 30일)
Gova ReDDy
Gova ReDDy 2013년 12월 26일
댓글: Image Analyst 2013년 12월 26일
Hello, I used a moving average filter of 30 order as shown below for the attached signal and the output of the moving average filter starts from the some other value instead of starting from the original input value when it comes for filtering the new set of values there is new set input values as shown in the image with the green portion
P=load('Noise_Pulse_signal.mat');
a2=P.a1;
x1=a2(1:500,:);
for i=1:500:length(a2)-1500
x1=a2(i:i+499,:);
movingAverage = conv2(x1,ones(30,1)/30, 'same');
Mov_avrg(i:i+499,:)=movingAverage;
input(i:i+499,:)=x1;
end;
plot(input);hold on;plot(Mov_avrg,'-r');
hleg1 = legend('input','MovAvrg');
Can someone explain the reason for this.

답변 (1개)

Image Analyst
Image Analyst 2013년 12월 26일
The 'same' option assumes that the signal is zero outside of the signal. So the part of the window that spills outside the signal is zero, which is less than your signal. So it makes absolute prefect sense that the first 15 and last 15 elements of your moving average signal will be lower than the input signal.
  댓글 수: 2
Gova ReDDy
Gova ReDDy 2013년 12월 26일
thankyou and Is there any way of modifying the filter so that the filter will response will start from the same intial value as the input.
Image Analyst
Image Analyst 2013년 12월 26일
I don't think you know how the filter works. To have the window fully covering the signal, the center of the window has to be half a window's width inside the signal. Just draw it out and you'll see. There is a 'valid' option which will use that case but the output will be a window's width shorter than the input signal for obvious reasons.

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

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by