how linear fir algorithm works?

2 visualizaciones (últimos 30 días)
shalini singh
shalini singh el 19 de Abr. de 2020
Respondida: Prabhan Purwar el 26 de Abr. de 2020
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

Respuesta aceptada

Prabhan Purwar
Prabhan Purwar el 26 de Abr. de 2020
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!!

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by