1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| close all ;
clear all;
clc
[fileout,pathout] =uigetfile('*.CSV');
chemin = [pathout,fileout]
Valeurs=xlsread(chemin);
x=size(Valeurs)-1; %your signal
Fs = 512; % recall Nyquist sampling frequency, it must be
% at least twice that of sampled signal
% but it is better if it is higher than that
L = length (x); % length of signal (number of sample values)
T = 1./Fs; % sampling period
t = [0:L-1]*T; % time scale for time domain
f = Fs/2*linspace(-1,1,L); % frequency scale for freq. domain
signal=x; % generated signal is anything we like
FFTsignal = fft(signal)/L; % fft of signal (freq domain)
figure(); % always create new figure for your plots
subplot(2,1,1),plot(t,signal);
%axis([0 3/f1 -1.1 1.1]);
title('Signal in time domain');
subplot(2,1,2),plot(f,abs(fftshift(FFTsignal)));
%axis([-2*f1 2*f1 -1.1 1.1]);
title('Signal in frequency domain'); |