% Test de la fonction FFT clear all; close all; clc; global Window_Size % Definition of the parameters for the Frequency analysis Method = 'Hamming'; % Selection of windowing: 'Hamming' / 'Hann' / 'Rectangle' fs = 2000; % Hz Sampling frequency Overlap = 0.5; % 50% of overlap Window_Size = 2^13; % Attention, on ne peut pas mettre n'importe quelle valeur ! Cela dépend de la fréquence d'échantillonage, de la longueur du signal, ... % Definition of a sinus for a test f = 200.1; % Frequency Careful : choose a frequency corresponding to one multiple of the frequency resolution ! A = 2; % Amplitude Time = [0:1/fs:20]; Signal = A*sin(2*pi*f*Time); % Application of the Sxx function [Frequency, Sxx] = Sxx_Function_Local(Time, Signal, Method, Overlap, Window_Size); % Display figure(1) subplot(2,1,1) plot(Time, Signal) xlim([0 max(Time)]) subplot(2,1,2) plot(Frequency, (Sxx)) xlim([0 500]) % Computation of the maximum amplitude [Max_Value, Idx] = max(sqrt(Sxx)); fprintf('The maximum amplitude of the signal is equal to : %.2f\n', Max_Value)