Request for review of FFT conversion results

1 次查看(过去 30 天)
Although it is not data related to noise and vibration, I would like to do FFT on resistance values that change with a specific speed (10 rpm).
But as you can see in the picture, the maximum comes out at 0 Hz. I think the Peak value would occur in another area(Hz), so if you can look at the attachment and code and advise on how to solve it, I would appreciate it.
clear all
clc
A = xlsread('2F100.xlsx','0.2m','D3:F812');
t = A(:,1);
r = A(:,3);
subplot(2,1,1), plot(t, r, 'linewidth', 2)
xlim([0 80])
ylim([0 30])
xlabel('t (seconds)','fontsize',16,'FontName','Arial')
ylabel('Resistance (\Omega)','fontsize',16,'FontName','Arial')
set(gca,'FontName','Arial','FontSize',14,'FontWeight','bold','XTick',...
[0 10 20 30 40 50 60 70 80]);
Fs = 1000;
Y = fft(r);
L = length(r);
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;
subplot(2,1,2), plot(f, P1, 'linewidth', 2) %semilogx(f,P1)
xlim([0 500])
ylim([0 10])

采纳的回答

Sulaymon Eshkabilov
编辑:Sulaymon Eshkabilov 2023-12-6
One option is zeroing the DC component by removing the mean of the signal and/or setting DC component equal to zero:
A = xlsread('2F100.xlsx','0.2m','D3:F812');
t = A(:,1);
r = A(:,3);
% Remove mean of r
r=r-mean(r);
subplot(2,1,1), plot(t, r, 'linewidth', 2)
xlim([0 80])
ylim([0 30])
xlabel('t (seconds)','fontsize',16,'FontName','Arial')
ylabel('Resistance (\Omega)','fontsize',16,'FontName','Arial')
set(gca,'FontName','Arial','FontSize',14,'FontWeight','bold','XTick',...
[0 10 20 30 40 50 60 70 80]);
Fs = 1000;
Y = fft(r);
L = length(r);
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;
% Set equal value 1 equal to "0"
%P1(1)=0;
subplot(2,1,2), plot(f, P1, 'linewidth', 2) %semilogx(f,P1)
xlim([0 500])
% Chnage the y-axis limits
ylim([0 3.5])
  1 个评论
J
J 2023-12-6
Thank you for your answer. In the time region(upper graph), the y value was shifted by about 10, and in the frequency region(lower graph), the y value decreased by one-third. Can I see this as the effect of zeroing through the removal of the average value?

请先登录,再进行评论。

更多回答(1 个)

Sulaymon Eshkabilov
The two can be also compared:
A = xlsread('2F100.xlsx','0.2m','D3:F812');
t = A(:,1);
r = A(:,3);
% Remove mean of r
r1=r-mean(r);
subplot(2,1,1),
plot(t, r, 'linewidth', 2)
hold on
plot(t, r1, 'r-', 'linewidth', 1)
legend('Original', 'Mean removed')
xlim([0 80])
ylim([0 30])
xlabel('t (seconds)','fontsize',16,'FontName','Arial')
ylabel('Resistance (\Omega)','fontsize',16,'FontName','Arial')
set(gca,'FontName','Arial','FontSize',14,'FontWeight','bold','XTick',...
[0 10 20 30 40 50 60 70 80]);
Fs = 1000;
Y1 = fft(r1);
L = length(r1);
P2 = abs(Y1/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
subplot(2,1,2),
plot(f, P1, 'linewidth', 2) %semilogx(f,P1)
hold on
Y = fft(r);
L = length(r);
PP2 = abs(Y/L);
PP1 = PP2(1:L/2+1);
PP1(2:end-1) = 2*PP1(2:end-1);
f = Fs*(0:(L/2))/L;
% Set equal value 1 equal to "0"
PP1(1)=0;
plot(f, PP1, 'r-', 'LineWidth', 1)
legend('Mean removed', 'DC = 0')
xlim([0 500])
% Change the y-axis limits
ylim([0 3.5])
% FFT of : Mean removed and DC=0 matches quite well

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by