Advertisement
Guest User

inputconv

a guest
Jul 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.35 KB | None | 0 0
  1. function [y] = inputSideConvolution(s, h)
  2.  
  3. y = zeros(1, length(s)+length(h)-1);
  4. for i=1:length(s)
  5.     for j=1:length(h)
  6.         y(i+j-1) = y(i+j-1) + s(i)*h(j);
  7.     end
  8. end
  9.  
  10. subplot(3, 1, 1);
  11. stem(s);
  12. title('Signal');
  13.  
  14. subplot(3, 1, 2);
  15. stem(h);
  16. title('Impulse Response');
  17.  
  18. subplot(3, 1, 3);
  19. stem(y);
  20. title('Convolution');
  21.  
  22. disp(y);
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement