tsounakis

1.1

Nov 3rd, 2021
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.68 KB | None | 0 0
  1. function one_1()
  2.     clc;
  3.     clear;
  4.     x = [1 -2 2 -1];        % σήμα
  5.     h = [1 -1 1];           % σήμα
  6.     n = 1:1:length(x);
  7.    
  8.     a(x, n);                 % υποερώτημα Α'
  9.     c(x, h);                 % υποερώτημα Γ'
  10. end
  11.  
  12. function a(x, n)
  13.     stem(n-1, x, "filled", "ro");
  14.     ylim([-4,4]);
  15.    
  16.     xticks(0:1:4);
  17.     xlim([0,4]);
  18.    
  19.     grid on;
  20.     ylabel("Amplitude of Signal");
  21.     xlabel("Time (t)");
  22.     figure;
  23.    
  24.     fft(x)
  25. end
  26.  
  27. function c(x, h)
  28.     x(8) = 0;
  29.     h(numel(x)) = 0;
  30.     fx = fft(x);
  31.     fh = fft(h);
  32.     fop = fx .* fh;
  33.     op = ifft(fop)
  34.    
  35.     stem(op, "filled", "gr");
  36.     grid on;
  37.    
  38. end
Advertisement
Add Comment
Please, Sign In to add comment