Am I using yulewalk() correctly?
5 views (last 30 days)
Show older comments
Christoph F. on 20 Sep 2016
Commented: Christoph F. on 29 Sep 2016
I am trying to figure out if I am using the yulewalk function (signal processing toolbox) correctly.
In a basic example, I try to find the filter coefficients of a filter previously generated with MatLAB. I would expect yulewalk to generate a filter that exactly matches the original filter.
% Generate second-order Butterworth filter
[Bx, Ax]=butter(2, 0.13)
% Calculate frequency and magnitude vectors
[H, F]=freqz(Bx, Ax, 0:0.01:1, 2);
% Use yulewalk to generate a filter that should match Bx and Ax
[B, A] = yulewalk(2, F, abs(H))
However, [B, A] is completely different from [Bx, Ax].
Other, similar functions (invfreqz, stmcb) generate a filter that exacly matches the original, but they either work with complex amplitudes (invfreqz) or in the time domain (stmcb).
Is this a limitation of the Yule-Walker algorithm, or am I using the yulewalk function incorrectly?
Michael Abboud on 27 Sep 2016
The Yule-walker filter design does not use phase information for the design of the filter, so filters with different coefficients could give you the same magnitude response, but different phase and amplitude.
Also, order 2 is a rather low for such a system, and will likely lead to a rough approximation of the coefficients. However if you increase the order, e.g [B, A] = yulewalk(10, F, abs(H)); then you will obtain a response that has a very similar magnitude to the original system.
If you have any further questions, feel free to contact MathWorks Technical Support and somebody can work with you more closely about your specific use case.
Find more on Matched Filter and Ambiguity Function 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!