Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Coding Matlab function "filter" in C++
Replies: 6   Last Post: Feb 11, 2013 11:03 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Hossein

Posts: 5
Registered: 4/3/08
Re: Coding Matlab function "filter" in C++
Posted: Feb 5, 2013 3:17 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Does anyone know what I am misunderstandning about Filter function concept with initial conditions of z0 = zi*y(1) as set in filtfilt function???
I tried to write my own as,


% assuming den & num has the same length
FilterOrder = (length(num)-1)/2;

for i=1:N
for j=1:2*FilterOrder
if i-j < 1
xo(j) = z0(j);
yo(j) = 0;
else
xo(j) = x(i-j);
yo(j) = y(i-j);
end
end
y(i) = num(1)*x(i) + sum(num(2:end).*xo') - sum(den(2:end).*yo');
end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.