Request for review of FFT conversion results
2 次查看(过去 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])
0 个评论
采纳的回答
Sulaymon Eshkabilov
2023-12-6
编辑: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 个)
Sulaymon Eshkabilov
2023-12-6
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!