Advertisement
konradstr

Sprawko4 fixed

Jan 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.51 KB | None | 0 0
  1. clear all;
  2.  
  3. %Stałe
  4. h=fir1(18,0.3);
  5. t = 0:0.0015:1;
  6.  
  7. %sygnały wejścia
  8. sin1=sin(2*pi*t*15);
  9. sin2=sin(2*pi*t*350);
  10.  
  11. x = sin1+sin2;
  12. y = zeros(1, length(x));
  13.  
  14. for n=1:length(x)
  15.     for m=1:length(x)
  16.         try
  17.             temp = h(m)*x(n-m);
  18.         catch
  19.             temp = 0;
  20.         end
  21.         y(n)=y(n) + temp;
  22.     end
  23. end
  24.  
  25. % Rysowanie wykresów
  26. figure(1);
  27. plot(t,sin1);
  28.  
  29. figure(2);
  30. plot(t,sin2);
  31.  
  32. figure(3);
  33. plot(t,x);
  34.  
  35. figure(4);
  36. freqz(h,1);
  37.  
  38. figure(5);
  39. plot(t,y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement