How to find the noisy signal using fourier transform for this data?

조회 수: 33 (최근 30일)
Mark Al Agha
Mark Al Agha 2021년 7월 14일
댓글: Hiril Patel 2022년 8월 26일
I was given the values M3 and t and told to analyze the noisy signal for every 5Hz, please check attached the values.

답변 (1개)

Scott MacKenzie
Scott MacKenzie 2021년 7월 14일
편집: Scott MacKenzie 2021년 7월 14일
Here's what I put together. The input signal is somewhat noisy, but it is also periodic @ 34.4 Hz.
f = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/684143/SPEED%20SENSOR.xlsx';
A = readmatrix(f);
t = A(:,2);
y = A(:,1); % M3 sensor values
n = length(y);
% remove NANs
nanLogical = isnan(t) | isnan(y);
t(nanLogical) = [];
y(nanLogical) = [];
% recale signal to +/- 1
y = rescale(y, -1, 1);
% determine sampling interval and rate
sInterval = mean(diff(t));
sRate = 1 / sInterval;
% perform fast fourier transform
Y = fft(y);
% get frequency spectrum
P2 = abs(Y/n);
P1 = P2(1:n/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = sRate*(0:(n/2))/n;
% plot signal and frequency spectrum
tiledlayout('flow');
nexttile;
plot(y(1:500)); % first 500 samples only (so wavefrom is visible)
title('Signal');
nexttile;
plot(f,P1);
title('Frequency Spectrum');
  댓글 수: 6
Scott MacKenzie
Scott MacKenzie 2021년 7월 16일
편집: Scott MacKenzie 2021년 7월 16일
The two plots actually contain the same information but with a different perspective.
The top plot is a "time domain" plot, with the x-axis representing time and y-axis representing the amplitude of the signal at each time point. To improve the look of the plot, I only plotted the 1st 500 samples. There are actually 70,000+ samples in total.
The bottom plot is a "frequency domain" plot of the same signal. The sampling frequency for your sensor was 100 Hz, so the x-axis of this plot goes from 0 to half this, or 50 Hz. The y-axis is the amplitude of the signal at each frequency. You can see some noise along the bottom, but there is a big spike at 34.4 Hz. This means the signal includes a periodic waveform at that frequency.
As for the code generating the frequency spectrum plot, it's mostly just copied from the examples in the documentation for the fft function. Have look there if you want the play-by-play details.
BTW, what is your sensor measuring?
Hiril Patel
Hiril Patel 2022년 8월 26일
I hope I am not too late here,
Can you tell me how do I find noise if I don't have the time stamps of the data? I only have recorded data from the sensor but the signal is noisy and now I discovered that I need time stamps to use FFT is there any work around for that?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by