Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

With Matlab, 3.1 Deconvolution Experiment for 1-D Filters Use the function firfi

ID: 3935766 • Letter: W

Question

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 0

Explanation / Answer

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote