Interpreting FFT Graph with Noise Floor

Hello,
I am trying to analyze data that I recorded from the Force Sensitive Resistors (FSRs) coded on Arduino through data streamer on excel. I used four FSRs, so there are 4 columns of data over a set of time (1200 rows, about 15 seconds). I seperated time from the FSR data so that I can graph the FFT of the FSR data against the time.
I succesfully made a correct code and have proper results from it, however I need help interpeting the graphs.
Code:
X = importdata('tapedata.csv');
t = importdata('tapetimefix.csv');
subplot(2,1,1);
plot(t,X);
grid
xlabel('Time')
ylabel('Amplitude')
title('FSR Recording (Tape)');
L = numel(X);
Ts = mean(diff(t));
% Tsd = std(mean(diff(t)))
Fs = 1/Ts;
Fn = Fs/2;
xft=fft(X-mean(X),[],1)/L;
xabs = abs(xft);
subplot(2,1,2);
plot(t,xabs);
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
xabs = abs(xft);
subplot(2,1,2);
plot(Fv,mag2db(xabs(Iv)*2))
grid
ylim([-75 50])
xlabel('Freqency [units]')
ylabel('Power [dB]')
title('FFT Analysis Graph (Tape)');
I was wondering is that just a lot noise or if there are no deviances from -50db meaning the FSRs is constant?

6 Comments

Hi Raidah,
Mostly nioise, but it's surprising that there are not a few larger peaks down at the first five or so frequencies. If you look at the linear plot and don't overwrite it with the dB plot, is there anything going on at the smallest frequencies?
so i zoomed up
still not much going on, so does that mean that the vibrations are miniscule?
The fft displayed is not the Fourier transform of the yellow line.
There is something wrong with the fft call.
what do you think maybe wrong with it?
It is not using whatever row or column that creates the yellow line to calculate the fft.
Since ‘tapedata.csv’ and ‘tapetimefix.csv’ are not provided, it is not possible to provide further details.
Here my apologies, I have attached it.

Sign in to comment.

 Accepted Answer

Try this —
X = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/613760/tapedata.csv');
t = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/613765/tapetimefix.csv');
SizeX = size(X)
SizeX = 1×2
1062 4
figure
for k = 1:size(X,2)
subplot(4,1,k)
plot(t, X(:,k))
title(sprintf('Column %d',k))
end
figure
subplot(3,1,1);
plot(t,X);
grid
xlabel('Time')
ylabel('Amplitude')
title('FSR Recording (Tape)');
L = size(X,1); % <= CHANGED
Ts = mean(diff(t));
% Tsd = std(mean(diff(t)))
Fs = 1/Ts;
Fn = Fs/2;
xft=fft(X-mean(X))/L;
xabs = abs(xft);
subplot(3,1,2);
plot(linspace(-Fn,Fn,numel(t)),mag2db(fftshift(xabs)*2));
grid
ylim([-75 50])
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
xabs = abs(xft(:,3)); % <= CHANGED
subplot(3,1,3);
plot(Fv,mag2db(xabs(Iv)*2))
grid
ylim([-75 50])
xlabel('Freqency [units]')
ylabel('Power [dB]')
title('FFT Analysis Graph (Tape)');
This appears to be close to the desired result.

4 Comments

Thank you so much! What does the second subplot in the middle represent?
My pleasure!
That is the fft of all the signals in the file, using fftshift to centre them. That was part of the original code, so I left it in, although I added the last plot by re-numbering the subplots.
The code without it becomes —
X = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/613760/tapedata.csv');
t = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/613765/tapetimefix.csv');
SizeX = size(X)
SizeX = 1×2
1062 4
figure
for k = 1:size(X,2)
subplot(4,1,k)
plot(t, X(:,k))
title(sprintf('Column %d',k))
end
figure
subplot(2,1,1);
plot(t,X(:,3));
grid
xlabel('Time')
ylabel('Amplitude')
title('FSR Recording (Tape)');
L = size(X,1); % <= CHANGED
Ts = mean(diff(t));
% Tsd = std(mean(diff(t)))
Fs = 1/Ts;
Fn = Fs/2;
xft=fft(X-mean(X))/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
xabs = abs(xft(:,3)); % <= CHANGED
subplot(2,1,2);
plot(Fv,mag2db(xabs(Iv)*2))
grid
ylim([-75 50])
xlabel('Freqency [units]')
ylabel('Power [dB]')
title('FFT Analysis Graph (Tape)');
filtered_FSR = lowpass(X(:,3), 4.5, Fs, 'ImpulseResponse','iir');
figure
subplot(2,1,1);
plot(t,X(:,3));
grid
xlabel('Time')
ylabel('Amplitude')
title('Original Signal')
subplot(2,1,2);
plot(t,filtered_FSR);
grid
xlabel('Time')
ylabel('Amplitude')
title('Filtered Signal')
sgtitle('FSR Recording (Tape)');
I added the filter to remove some of the high-frequency noise. Experiment with it if you want to filter the signal
I see thank you, I was able to learn so much from this.
As always, my pleasure!

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!