Advertisement
Zidinjo

Labor7 fertig

Dec 9th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. %Marvin Meier
  2. %Aufgabe 7 : Rechteck programmieren und transformieren in den
  3. %Frequentbereich
  4.  
  5. %Abtastrate
  6. fa = 11025;
  7.  
  8. %Länge des Signals
  9. duration = 1.0;
  10.  
  11. %50Hz im Frequenzbereich
  12. hzAngabe = 50;
  13.  
  14. %Definition des start und stop
  15. start = 0.4;
  16. stop = 0.6;
  17.  
  18. %Komplettes Signal wird auf 0 gesetzt
  19. rectSignal = zeros(1,fa*duration);
  20.  
  21. %Wird der Abtastrate angepasst
  22. stopFa = floor(stop*fa);
  23. startFa = floor(start*fa);
  24.  
  25. %Zeitvektor
  26. tVec = 0:1/fa:duration-1/fa;
  27.  
  28. %Stop und Start
  29. %einsenVektor = ones(1,stopFa-startFa);
  30.  
  31. rectSignal(startFa:stopFa) = 1;
  32.  
  33. %In den Frequenzbereich umgewandelt
  34. [specVec, phaVec] = funcRdft(rectSignal, length(rectSignal));
  35.  
  36. xFVec = 0:1:hzAngabe-1;
  37. %Abbildung 1 Zeitbereich
  38. figure(1);
  39. subplot(3,1,1);
  40. plot(tVec,rectSignal);
  41. title('Zeitbereich');
  42. xlabel('Zeit in Sekunden');
  43. ylabel('Amplitude');
  44.  
  45. %Abbildung 1 Frequenzbereich
  46. subplot(3,1,2);
  47. plot(specVec);
  48. title('Frequenzbereich');
  49. xlabel('Hz bis fa/2');
  50. ylabel('Amplitude');
  51.  
  52. %Offset nach oben schieben
  53. %Abbildung 1 Frequenzbereich 25 Hz
  54. subplot(3,1,3);
  55. plot(xFVec,specVec(1:hzAngabe));
  56. title('Frequenzbereich');
  57. xlabel('Hz bis 50 obere Frequenz');
  58. ylabel('Amplitude');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement