From 4f4b634dc8bc42f2ce98876ee6d70d45b00553fd Mon Sep 17 00:00:00 2001 From: Filipriec Date: Thu, 13 Nov 2025 14:47:18 +0100 Subject: [PATCH] semestralka a praca na nej --- semestralka/1.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/semestralka/1.m b/semestralka/1.m index 7c61de6..1a3ca05 100644 --- a/semestralka/1.m +++ b/semestralka/1.m @@ -9,13 +9,24 @@ data = int16(str2double(nums)); X = DFT_priama(double(data)) n = length(X) -freq = (0:n-1)/n +Fs = 200; +freq = (0:n-1)*Fs/n figure; plot(double(data)); figure; plot(freq, X) figure; +x = double(data); +x = x - mean(x); +plot(x); % centrovane data +figure; plot(freq, abs(X)) figure; plot(freq, angle(X)) + +magX = abs(X); +[pks, locs] = findpeaks(magX, 'NPeaks', 6, 'SortStr', 'descend'); + +f0 = freq(locs); +disp(f0);