Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Help with FFT Analysis

2 views (last 30 days)
Vince Roman
Vince Roman on 24 Feb 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi,
How could I use the fft analysis on this signal:
I am trying to find which filter would be the most ideal to get as close to the original signal as I can.
% Signal Generation
xLim = 1000; % Generate numbers from 0 to 1000.
dx = 0.01; % Increment of 0.01.
x = 0:dx:xLim-1; % Generate a series of numbers from 0 to 999 (xLim-1) with increment of 0.01.
y0 = 6*sin(0.4*pi*x); % Create sine signal.
y = awgn(y0,0.01,'measured'); % Addition of noise
% Filtering of Noise using Savitzky-Golay
N = 2;
% Filter 1 F = 11; % Window length 11,23,35,47,59
[b,g] = sgolay(N,F); % Calculate S-G coefficients
HalfWin = ((F+1)/2) -1;
for n = (F+1)/2:(length(x)-5)-(F+1)/2,
% Zeroth derivative (smoothing only)
SG1(n) = dot(g(:,1),y(n - HalfWin:n + HalfWin));
end
% Filter 2 F = 23; % Window length 11,23,35,47,59
[b,g] = sgolay(N,F); % Calculate S-G coefficients
HalfWin = ((F+1)/2) -1;
for n = (F+1)/2:(length(x)-5)-(F+1)/2,
% Zeroth derivative (smoothing only)
SG2(n) = dot(g(:,1),y(n - HalfWin:n + HalfWin));
end
At the moment I tried to use: A1=fft(SG1); A2=fft(SG2);
Not really sure how to apply the fft coding and if I am doing it correctly, I was told I can also use snr after between the filtered data and the fft data after carrying out the FFT analysis of the noisy signal
Thanks

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!