Debug nested loop to calculate frequency sampling fir filter coefficients
Show older comments
Hello all,
I'm trying to simulate a frequency sampling fir filter, and I'm getting unanticipated output from my for loop. I don't understand why the first n-loop finishes (to 21), but the following iterations stop at n=1. Could I get another set of eyes on my code? Thank you, Justin

Hk =[Hb(6915) Hb(7517) Hb(8118) Hb(8719) Hb(9320) Hb(9922) Hb(10523) Hb(11124) Hb(11726) Hb(12327)] ;
H_ks = zeros((N-1)/2,N);
for k = 1:(length(k)-1)/2
for n = 1:length(n)
H_ks(k,n) = (2/N)*Hk(k)*cos((2*pi)/N).*k.*(n-((N-1)/2));
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!