Obtain plot for displacement history.

조회 수: 2 (최근 30일)
Juan Gonzalez
Juan Gonzalez 2022년 12월 28일
편집: Walter Roberson 2025년 1월 2일
Y = fft(diff(strainoption2));
L = size(diff(strainoption2));
L = L(1);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
figure()
plot(f,P1)

답변 (1개)

Divyam
Divyam 2025년 1월 2일
The approach for obtaining the plot for displacement history in the question is correct. For the sake of clarity I have added descriptions for the plot and checks for the single sided spectrum P1.
% Assuming strainoption2 is defined and Fs is the sampling frequency
strain_diff = diff(strainoption2);
Y = fft(strain_diff);
% Determine the length of the differentiated strain data since data is 1D
L = length(strain_diff);
P2 = abs(Y/L);
P1 = P2(1:floor(L/2)+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs * (0:floor(L/2)) / L;
% Plot the single-sided amplitude spectrum
figure();
plot(f, P1);
title('Single-Sided Amplitude Spectrum of Displacement History');
xlabel('Frequency (Hz)');
ylabel('|P1(f)|');

카테고리

Help CenterFile Exchange에서 Filter Analysis에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by