Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Ein Rechteck in einem gewissen Zeitintervall innerhalb einer Sekunde
- % Hier fehlen noch Kommentare
- %
- % Marvin Meier, 570113
- % Niklas Springhorn, 570407
- % 03.12.2015
- close;
- clear all;
- fa = 11025;
- amp = 1;
- f = 1000; % khZ
- duration = 1.0; % s
- tonVec = [];
- pauseDuration = 1;
- % Rechteck mit Frequenz 1Hz erzeugen
- % square = funcGeneratePeriodic(4, amp, f, 1, duration, fa, 0);
- sta = 0.1;
- sto = 0.4;
- start = min(sta, sto);
- stop = max(sta, sto);
- % 1 * fa ist eine Sekunde.
- aSecondSquare = zeros(1,floor(fa*duration));
- % Wenn der Start gleich null ist, müssen wir beim ersten Wert anfangen
- startIndex = max(1, floor(start * fa));
- endIndex = floor(stop * fa);
- aSecondSquare(startIndex:endIndex) = 1;
- % Der eigentliche "Square-Bereich" wäre folgender:
- % square = aSecondSquare((timeFrame(1)*fa):(timeFrame(2)*fa));
- % TVec für x-Achse
- tVec = 0:1/fa:duration-1/fa;
- % Umwandeln in den Frequenzbereich
- [specVec, phaVec] = funcRdft(aSecondSquare, length(aSecondSquare));
- figure(1);
- % Darstellung im Zeitbereich
- subplot(3, 1, 1);
- plot(tVec, aSecondSquare);
- title('Zeitbereich');
- xlabel('Zeit in s');
- ylabel('Amplitude');
- % Darstellung im kompletten Frequenzbereich
- subplot(3, 1, 2);
- plot(specVec);
- title('Kompletter Frequenzbereich');
- xlabel('Frequenz in Hz');
- ylabel('Amplitude');
- % Darstellung im Frequenzbereich (Ausschnitt)
- threshold = 20; % Bis zu wie viel Hertz soll angezeigt werden?
- tVec = [0:1:threshold];
- subplot(3, 1, 3);
- plot(tVec, specVec(1:threshold+1));
- title('Kompletter Frequenzbereich (Ausschnitt)');
- xlabel('Frequenz in Hz');
- ylabel('Amplitude');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement