Hello everyone
Reading legacy.cnx.org/content/m10577/latest/ there is a Matlab code suggesting an example of usage. Using it, I was trying to make it work for a type II, but failed. First, with Octave, I used q=wp*sinc(wp.*n) + K*(sinc(n) - ws*sinc(ws.*n)) with n=0.5:1:2*M+1, but it didn't work. Then I tried, as suggested in the paper, ifft, with about the same results. Then I realized that, for a type II ifft, Octave zero-pads the magnitude with the grid size, then ifft, then chooses every second sample. I followed that approach with both explicit q (the first formula I mentioned), and with ifft, but still, no success. Can someone please let me know where my reasoning went wrong? A hint to a solution would be welcome, too.
Anticipated thanks,
Vlad
This question has been asked and answered here, but I'll repeat it here, as well:
---
I may have found the answer. The Q matrix, made from the sum of the Hankel and Toeplitz forms, stems from:
$$ cos(k\omega)cos(n\omega)=\frac{1}{2}\left[cos((k-n)\omega)+cos((k+n)\omega)\right] $$
but with the additional 0.5 for even orders, it comes out as:
$$ cos((k+0.5)\omega)cos((n+0.5)\omega)=\frac{1}{2}\left[cos((k-n)\omega)+cos((k+n+1)\omega)\right] $$
and since the k+n term makes the Hankel matrix, it needs an increment in its indices, and the q vector longer by 1. The b vector only needs the extra 0.5. Now the relevant code lines look like this:
q = [wp + K*(1 - ws), wp*sinc(wp.*n) - K*ws*sinc(ws.*n)]; Q = toeplitz(q(m + 1)) + hankel(q(m + 1 + oddN), q(m + 1 + M + oddN)); b = wp*sinc(wp.*(m + 0.5))';
and this is a comparison between a 30th and a 31st orders, with \( f=[0 0.3 0.4 1], A=[1 1 0 0], K=[1 10] \):
What I don't understand now is why the q vector is not made with the 0.5 sampling offset.







