Here is a small MATLAB function that computes B in B/A given A and the impulse response h of B/A

function b = numf(h,a,nb)
%NUMF   Find numerator B given impulse-response h of B/A and denominator A
%   NB is the numerator order. 

nh = max(size(h)); 
impr = filter(1,a,[1 zeros(1,nh-1)]);

egqs = toeplitz(impr,[1 zeros(1,nb)]);

b = h/egqs';

Could someone help me understand why these steps give B.

I get what filter() and toeplitz() do, but not the last line : b = h/egqs'

Thanks for any help,



The vector impr holds the impulse response of length nh of an all-pole filter with denominator coefficients given by a. Let's call this impulse response $g(n)$. The impulse response $h(n)$ must satisfy the equation


where * denotes convolution. With the given data, this results in an overdetermined system of linear equations, the system matrix of which is the Toeplitz matrix egqs. The last line in the code solves this overdetermined system of linear equations corresponding to (1) in a least-squares sense. You could achieve the same using the backslash operator:

b = egqs\h';
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.