application of fft analyzer
Show older comments
Hello
I'm currently studying a vibratory system, each time I pick up the acceleration as a function of time, to have easy-to-read curves, I've applied the fourier transform and then the magnitude and phase calculation to plot them, but I still had curves with a lot of noise and that didn't translate my values even though I applied a smoothing. Is there another solution to make a good study of vibratory systems, also you will find my matlab code here, thanks for your help.
% Lecture des données d'accélération à partir d'un fichier Excel
clc;clear;
a = xlsread('test(30,50,-100,0,0,0).xlsx', 'C:C');% colonne A contient les données d'accélération
Time = xlsread('test(30,50,-100,0,0,0).xlsx', 'A:A');
%Tracé de la courbe d'accélération en fonction du temps
%figure(1);
%plot(Time, a);
%xlabel('fréquence');
%ylabel('Accélération (m/s^2)');
%FFT
L = length(a);
Fs = find(Time == interp1(Time, Time , 1.0,'nearest'))-1; %compute sample freq, Fs
%Fs = 1 / (Time(2) - Time(1));
n=2^nextpow2(L);
%n = 2^24;
X=fft(a, n);
P2 = abs(X/L);
P1 = P2(1:n/2+1);
P1(:,2:end-1) = 2*P1(:,2:end-1);
P1 = P1/max(P1);
f = Fs*(0:(n/2))/n;
%figure(2);
%plot(f,P1, 'b')
%grid on
% Calcul de la magnitude et de la phase
magnitude = abs(X(1:L/2+1));
phase = angle(X(1:L/2+1));
% Tracé du diagramme de Bode
figure;
subplot(2, 1, 1);
semilogx(f(1:L/2+1), 20*log10(magnitude)); % Tracé de la magnitude en échelle logarithmique
xlabel('Fréquence (Hz)');
ylabel('Magnitude (dB)');
title('Diagramme de Bode - Magnitude');
subplot(2, 1, 2);
semilogx(f(1:L/2+1), rad2deg(phase)); % Tracé de la phase en échelle logarithmique
xlabel('Fréquence (Hz)');
ylabel('Phase (degrés)');
title('Diagramme de Bode - Phase');
%Lissage magnetude
%freq = f(1:L/2+1);
%mag = 20*log10(magnitude);
%windowSize = 100; % Taille de la fenêtre de moyenne mobile
%b = (1/windowSize)*ones(1,windowSize);
%a = 1;
%amplitude_lisse = filter(b, a, mag);
%figure(4);
%plot(freq,amplitude_lisse)
%grid on
%lissage de phase
%freq = f(1:L/2+1);
%PH = rad2deg(phase);
%windowSize = 100; % Taille de la fenêtre de moyenne mobile
%b = (1/windowSize)*ones(1,windowSize);
%a = 1;
%amplitude_lisse = filter(b, a, PH);
%figure(4);
%plot(freq,amplitude_lisse)
%grid on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lissage de l'amplitude par moyenne mobile
%windowSize = 100; % Taille de la fenêtre de moyenne mobile
%b = (1/windowSize)*ones(1,windowSize);
%a = 1;
%amplitude_lisse = filter(b, a, P1);
%figure(3);
%plot(f,amplitude_lisse)
%grid on
Accepted Answer
More Answers (0)
Categories
Find more on Vibration Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!