# Request for review of FFT conversion results

1 回表示 (過去 30 日間)
J 2023 年 12 月 6 日

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
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 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:
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 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
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 2023 年 12 月 6 日
The two can be also compared:
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

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by