moving filter average with convolutional function
조회 수: 10 (최근 30일)
이전 댓글 표시
For question 2i, I am confused that question, I have understanded in 2 ways:
firstly, we take N as a vector and find y[n] by con(1./N,ecg)
secondly, we take each number of N and multiplies to conv(ecg, h) with h is delta function.
Which way is correct?
Thank you so much for your answer
댓글 수: 0
채택된 답변
Image Analyst
2022년 2월 15일
No, N is not a vector it's a number, though you can make a vector from all the Ns:
allN = [2, 4, 8, 16, 32];
plot(ecg, 'b-', 'LineWidth', 3);
grid on;
for k = 1 : length(allN)
% Get this one N
N = allN(k);
% Construct kernel
h = ones(1, N) / N;
% Do the convolution, cropping to the same size as the input vector.
output = conv(ecg, h, 'same');
% Plot it.
hold on;
plot(output, '-');
% Create the string for the legend since all plots show up in different colors.
legendStrings{k} = sprintf('N = %2.2d', N);
end
legend(legendStrings);
추가 답변 (1개)
Benjamin Thompson
2022년 2월 15일
Are you asking how to define h in MATLAB?
>> h = ones(8,1)/8
h =
0.1250
0.1250
0.1250
0.1250
0.1250
0.1250
0.1250
0.1250
Then if you have an input signal ecf you can call conv(h, ecg)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!