[D,S,R] = xlsread('test data.csv');
RD = str2double(R);
Signal = RD(:,2);
Ts = 0.00005;
Fs = 1/Ts;
Fn = Fs/2;
N = length(Signal);
meanSignal = mean(Signal);
FTSignal = fft(Signal-meanSignal)/N;
Fv = linspace(0, 1, fix(numel(FTSignal)/2)+1)*Fn;
Iv = 1:numel(Fv);
[pks,locs] = findpeaks(abs(FTSignal(Iv))*2, 'MinPeakHeight',0.044);
figure
plot(Fv, abs(FTSignal(Iv))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
plotIdx = 1:Iv(max(locs));
figure
plot(Fv(plotIdx), abs(FTSignal(Iv(plotIdx)))*2)
hold on
plot(Fv(plotIdx(locs)), pks, '^r', 'MarkerFaceColor','r')
hold off
xlabel('Frequency (Hz)')
ylabel('Amplitude')
text(0.005, 0.08, 'Choose a peak and frequency')
2 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/507362-perform-fft-from-imported-excel-data-help-please#comment_801836
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/507362-perform-fft-from-imported-excel-data-help-please#comment_801836
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/507362-perform-fft-from-imported-excel-data-help-please#comment_802350
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/507362-perform-fft-from-imported-excel-data-help-please#comment_802350
Sign in to comment.