Advertisement
makispaiktis

Tutorial Thomas - How noise impacts a signal

Jul 23rd, 2021 (edited)
1,237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.55 KB | None | 0 0
  1. clc
  2. clear all
  3.  
  4. x = linspace(0, 4*pi, 1001);
  5. s = sin(x);
  6. A_signal = 10;              % Amplitude of signal
  7. A_noise = 0.5;              % Amplitude of noise ----> it will be the std
  8. s_noise = A_signal * s + A_noise * randn(1, 1001);
  9. figure(1);
  10. subplot(2,1,1);
  11. plot(x, s);
  12. title('Signal (sinx)');
  13. subplot(2,1,2);
  14. plot(x, s_noise);
  15. title('Signal (sinx) with noise');
  16.  
  17. figure(2);
  18. plot(x, A_signal * s, 'red');
  19. hold on
  20. plot(x, s_noise, 'blue');
  21. title('Signal (sinx) with and without noise');
  22. data = [s, s_noise];
  23. legend({'No noise', 'Noise'});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement