Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. %% Set parameters continuous signals
  2. fsc = 2500; %%sampling frequency in hz
  3. durc = 2; %%sampling duration in seconds
  4.  
  5. tc = linspace(0,durc,durc*fsc);
  6.  
  7. %% Sinusoids continuous
  8. x1c = 2*cos(2*pi*200*tc + pi/3);
  9. x2c = 5*cos(2*pi*350*tc+pi/2);
  10. x3c = 5*cos(2*pi*600*tc+pi/4);
  11. xtc = x1c + x2c + x3c;
  12.  
  13. %% Set parameters discrete signals
  14. fsn = 1000; %%sampling frequency in hz
  15. durd = 2; %%sampling duration in seconds
  16.  
  17. tsn = 1/fsn;
  18. tn = linspace(0,durd,durd*fsn);
  19.  
  20. %% Define parameters for the sinusoids
  21. freq1 = 200;
  22. theta1 = 1.26;
  23. phase1 = pi/3;
  24. acfreq1 = (theta1 * fsn) / (2*pi);
  25.  
  26. freq2 = 350;
  27. theta2 = 2.20;
  28. phase2 = pi/2;
  29. acfreq2 = (theta2 * fsn) / (2*pi);
  30.  
  31. freq3 = 600;
  32. theta3 = -2.51;
  33. phase3 = -1 * pi/4;
  34. acfreq3 = (theta3 * fsn) / (2*pi);
  35.  
  36. %% Sinusoids discrete
  37. x1d = 2*cos(2*pi*acfreq1*tn + phase1);
  38. x2d = 5*cos(2*pi*acfreq2*tn + phase2);
  39. x3d = 5*cos(2*pi*acfreq3*tn + phase3);
  40. xnd = x1d + x2d + x3d;
  41.  
  42. subplot(211)
  43. plot(tn*tsn,xnd)
  44. subplot(212)
  45. plot(tc,xtc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement