arpit01

GENERALAZED CONVOLUTION

Nov 28th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. close all
  2. clear all
  3. x=input('Enter x: ')
  4. subplot(2,2,1)
  5. stem(x)
  6. h=input('Enter h: ')
  7. subplot(2,2,2)
  8. stem(h)
  9. m=length(x);
  10. n=length(h);
  11. X=[x,zeros(1,n)];
  12. H=[h,zeros(1,m)];
  13. for i=1:n+m-1
  14. Y(i)=0;
  15. for j=1:m
  16. if(i-j+1>0)
  17. Y(i)=Y(i)+X(j)*H(i-j+1);
  18. else
  19. end
  20. end
  21. end
  22. subplot(2,2,3)
  23. stem(Y);
  24. ylabel('Y[n]');
  25. xlabel('----->n');
  26. title('Convolution of Two Signals without conv function');
Add Comment
Please, Sign In to add comment