0% found this document useful (0 votes)
82 views

Matlab Code

The document contains code to analyze experimental vibration data from different structural setups. It reads in data files, applies a Hamming window to the data, computes the fast Fourier transform (FFT), and plots the amplitude spectra on two figures with different line colors and legends to distinguish the setups. It loops through 1-4 data files corresponding to different support conditions and structural components.

Uploaded by

api-349699978
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Matlab Code

The document contains code to analyze experimental vibration data from different structural setups. It reads in data files, applies a Hamming window to the data, computes the fast Fourier transform (FFT), and plots the amplitude spectra on two figures with different line colors and legends to distinguish the setups. It loops through 1-4 data files corresponding to different support conditions and structural components.

Uploaded by

api-349699978
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

% Common variables figure(1)

clear all; title([title_text])


clc; xlabel('Frequency (Hz)');
title_text = 'All Setups, Speed 10, 45 Degree ylabel('Amplitude (voltage)');
Angle' if no_files ==1;
ylim_low = 1e-2; semilogy(freq,abs(xdft),'blue'); end
ylim_high = 1e2; if no_files ==2;
for no_files = 1:3 semilogy(freq,abs(xdft),'green'); end
if no_files ==3; semilogy(freq,abs(xdft),'red');
if no_files ==1; filename=('NS 45 deg speed end
10.xls'); end; if no_files ==4;
if no_files ==2; filename=('F 45 deg speed semilogy(freq,abs(xdft),'cyan'); end
10.xls'); end; legend('No Supports-blue', 'Rectangular
if no_files ==3; filename=('XF 45 deg speed Frames-green', 'Rectangular Frames and X
10.xls'); end; Brackets-red', 'Rectangular Frames and
if no_files ==4; filename=('PF 45 deg speed Pyramid-cyan')
10.xls'); end; hold on
[X,TXT,RAW] = xlsread(filename)
dotpos = find(filename == '.', 1, 'last'); % FFT plot
if ~isempty(dotpos); filename(dotpos:end) = figure(2)
[]; end
% xdft = fft(X(:,2)); if no_files ==1;
% % sampling interval -- assuming equal subplot(4,1,1);
sampling semilogy(freq,abs(xdft),'blue');
% DT = X(2,1)-X(1,1); semilogy(freq,xdft,'blue');
% % sampling frequency % ylim([ylim_low ylim_high])
% Fs = 1/DT; title([title_text]);
% DF = Fs/size(X,1); legend('No Supports-blue')
% freq = 0:DF:Fs/2; end
% xdft = xdft(1:length(xdft)/2+1); if no_files ==2; subplot(4,1,2);
semilogy(freq,xdft,'green');
Num_exp_data_points = length(X(:,2)); % ylim([ylim_low ylim_high])
index = linspace(0,Num_exp_data_points- ylabel('Amplitude (voltage)');
1,Num_exp_data_points)' ; legend('Rectangular Frames-green')
hamwind = 0.54 - 0.46*cos(2*pi*index/ end
(Num_exp_data_points-1)) ; if no_files ==3; subplot(4,1,3);
freqs_ex = (0:Num_exp_data_points/2 - 1)/ semilogy(freq,xdft,'red');
(X(end,1) - X(1,1)) ; % ylim([ylim_low ylim_high])
freq = freqs_ex; xlabel('Frequency (Hz)');
legend('Rectangular Frames X Brackets-
data_Win = red')
X(1:Num_exp_data_points,2).*hamwind ; end
spectrum = if no_files ==3; subplot(4,1,4);
fft(data_Win(1:Num_exp_data_points), semilogy(freq,xdft,'cyan');
Num_exp_data_points) ; % ylim([ylim_low ylim_high])
amp_fft = xlabel('Frequency (Hz)');
2*abs(spectrum(1:Num_exp_data_points/2))/Nu legend('Rectangular Frames and Pyramid-
m_exp_data_points; cyan')
xdft = amp_fft; end
end
% FFT plot

You might also like