From: Paul K. <pki...@ja...> - 2002-06-19 17:31:05
|
On Wed, Jun 19, 2002 at 11:13:02AM -0500, Hammett, Rich (Contractor - SimTech) wrote: > To whom should I direct questions about "toolkit" m-files? My specific > question is about the signal processing fir2.m file. There is a line > toward the bottom where the output is being centered and truncated, > as so: > > b = real ([ b([2*grid_n-floor(mid)+1:2*grid_n]) ; b(1:ceil(mid)) ]); > > However, the left half of that vector only goes to 2*grid_n, while > the input data goes to 2*grid_n + 1. And since we're wrapping the > output data, the point being left out is from the middle of the > data (just left of DC), not an outlier. grid = interp1(f,m,linspace(0,1,grid_n+1)'); ^^^^^^^^ grid will have grid_n+1 points. b = ifft([grid ; grid(grid_n:-1:2)]); ^^^^^^^^^^^ length(grid_n:-1:2) is grid_n-1, so b will have grid_n+1 + grid_n-1 = 2*grid_n points, not 2*grid_n + 1. The reflection contains neither the 0 nor the pi frequency components. Paul Kienzle pki...@us... |