Files
css/semestralka/1.m
2025-11-13 14:47:18 +01:00

33 lines
513 B
Matlab

clc;
close all;
clear all;
% semestralka
rawText = fileread('data6.dat');
nums = regexp(rawText, '[-+]?\d+', 'match');
data = int16(str2double(nums));
X = DFT_priama(double(data))
n = length(X)
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);