With Matlab 31 Deconvolution Experiment for 1D Filters Use t
With Matlab,
3.1 Deconvolution Experiment for 1-D Filters Use the function firfilt( to implement the following FIR filter w[n] = x[n]-0.9-r[n-1] on the input signal x[n] defined via the M ATLAB statement: xx you must define the vector of filter coefficients bb needed in firfilt. 2 56\" ( rem ( 0 : 1 00 , 50)10); In MATLAB (a) Plot both the input and output waveforms r[n] and w[n] on the same figure, using subplot. Make the discrete-time signal plots with MATLAB\'s stem function, but restrict the horizontal axis to the range 0Solution
function yy = firfilt(bb, xx)
if( length(bb)==1 )
    yy = bb(1)*xx;
 elseif( length(xx)==1 )
    yy = xx(1)*bb;
 elseif ndims(xx)==2   %- Every MATLAB matrix has at least dim=2
    if min(size(bb))>1
       error(\'>>>FIRFILT: filter coefficients cannot be a matrix\')
    elseif min(size(xx))>1
       warning(\'>>>FIRFILT: filtering the columns of the matrix xx\')
       xx( size(xx,1)+length(bb)-1,1 ) = 0; %-- force filter() to make all of y[n]
       yy = filter( bb, 1, xx );    
    elseif( length(bb)<=length(xx) )
       xx( length(xx)+length(bb)-1 ) = 0; %-- force filter() to make all of y[n]
       yy = filter( bb, 1, xx );
    else
       needTranspose = (size(xx,1)==1);
       bb( length(xx)+length(bb)-1 ) = 0; %-- force filter() to make all of y[n]
       yy = filter( xx, 1, bb(:) );
       if needTranspose, yy = yy\'; end
    end
 else
    error(\'>>>FIRFILT: does not work for more than two dimensions\')
 end
![With Matlab, 3.1 Deconvolution Experiment for 1-D Filters Use the function firfilt( to implement the following FIR filter w[n] = x[n]-0.9-r[n-1] on the input si With Matlab, 3.1 Deconvolution Experiment for 1-D Filters Use the function firfilt( to implement the following FIR filter w[n] = x[n]-0.9-r[n-1] on the input si](/WebImages/23/with-matlab-31-deconvolution-experiment-for-1d-filters-use-t-1054369-1761549833-0.webp)
