02-11-2010 07:22 AM
Hi
I have a script In Matlab that is using the built-in filter function in matlab.
y = filter(B,A,x);
were x is the signal to be filtered and A/B is the filter coefficients.
Is there a labview function that gives my the same y as Matlab does if x, A and B is the same.
Best wishes
02-11-2010 07:27 AM
02-11-2010 08:26 AM
02-11-2010 08:38 AM
02-11-2010 09:27 AM - edited 02-11-2010 09:29 AM
🙂 sorry. I post some Matlab code and VI to demonstrate.
Matlab code:
clear;
x = 1:12;
A = [1 2 1 1];
B = [1 1 2 1];
y = filter(B,A,x)
%y =
%
% 1 1 4 2 8 0 17 -10 40 -45 107 -157
%
y2 = filter(B,A,x, [0 1 0]')
%y2 =
%
% 1 2 2 5 3 9 1 18 -9 41 -44 108
%
and my VI is attached (screenshot). My Y is correct to the first filter call to matlab (y = y in both lw and matlab). And that is good. But the other call use a the vector Zi = [0 1 0] and from Matlabs help
[Y,Zf] = FILTER(B,A,X,Zi) gives access to initial and final
conditions, Zi and Zf, of the delays. Zi is a vector of length
MAX(LENGTH(A),LENGTH(B))-1, or an array with the leading dimension
of size MAX(LENGTH(A),LENGTH(B))-1 and with remaining dimensions
matching those of X.
Any idees how this can be done in LabView or what the Zi does in the Matlab implementation?
02-12-2010 08:04 AM
02-18-2010 10:49 AM