how linear fir algorithm works?
조회 수: 2 (최근 30일)
이전 댓글 표시
function [y,z] = fir_filt_linear_buff(b,x,z)
y = zeros(size(x));
for n=1:length(x)
z = [x(n); z(1:end-1)];
y(n) = b * z;
end
end
in this why z is used?
i dont understand the need to use z.
please help
댓글 수: 0
채택된 답변
Prabhan Purwar
2020년 4월 26일
Hi,
hope this example is leveraged from the following link:
The following function represents an FIR filter with a linear buffer, where b is a row vector and z is a column vector the same length as b. x represents the input signal, b represents the filter coefficients and z represents delay/buffer in the signal.
For example:
x=[1 2 3 4 5]; % Signal
b=[1 1 1 1 1]; % Filter Coefficients, kept as unity to demonstrate effect of z
z=[0 0 0 1 0]'; % Delay/buffer
y = zeros(size(x));
for n=1:length(x)
z = [x(n); z(1:end-1)];
y(n) = b * z
end
If z=[0 0 0 0 0]' (No delay) y=[1 3 6 10 15] (FIR Output) as expected
If z=[0 0 0 1 0]' (Delay of 1 at 4th col) y=[2 3 6 10 15]
If z=[0 0 1 0 0]' (Delay of 1 at 3rd col) y=[2 4 6 10 15]
if z=[0 1 0 0 0]' (Delay of 1 at 2nd col) y=[2 4 7 10 15]
if z=[1 0 0 0 0]' (Delay of 1 at 1st col) y=[2 4 7 11 15]
For more details refer to the FIR Filter Structures.
Hope it helps!!
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!