Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Coding Matlab function "filter" in C++
Posted:
Nov 30, 2005 12:54 PM


"Chris Heier" <enygma@gmail.com> writes:
>> y(n) = k2*x(n) + k1*(1+k2)*x(n1) + x(n2)  k1*(1+k2)*y(n1)  k2*y(n2) > > Hey thanks. That answers a ton for me. I guess the last thing I had > on my mind was in regards to n. > > Since X would be a trace containing an array of samples, x[0] would > contain the first sample. In the algorithm, there is a point where it > is asking for x[n1] and x[n2]. In the case that n would equal 0, the > first part (n1) would try to pull a value from the 1 element in the > array. How would I work around that for the first few elements of the > array?
Typically the signal is zeropadded. In "help filter", the function accepts "initial conditions", which would be used instead, in special applications. Blockbased filtering might be one of them, where there actually are two known values for the input prior to the x[0] in this context.
 Peter Boettcher <boettcher@ll.mit.edu> MIT Lincoln Laboratory MATLAB FAQ: http://www.mit.edu/~pwb/cssm/



