How do I eliminate large peaks using an FFT function?
Show older comments
Hi,
I have a small data set and wanted to try to use a FFT function to smooth out some of the larger peaks in the data curve. The data is of an increasing temperature ramp (about 900 - 1000C) and there's a linear trend. I realize this may not be the best method to smooth my data, but I wanted to try to do this with a FFT and see what comes out.
The data is from 1 second measurents so Fs = 1. My code is below. As it is right now, I get a choppier plot after I use the "fix" function. I think removes the small fluctuations and leaves me with the more defined signals (kind of the opposite of what i want).
if true
%
A = importdata('P:\TAT_1_FFT_test.dat');
Fs = 1;
dt = 1;
L = size(A,1);
t = 1:dt:L;
NFFT = nextpow2(L);
n=L/2;
ti = 1:1:2^NFFT;
Y = fft(A,2^NFFT);
amp_spec = abs(Y)/n;
subplot(2,1,1)
plot(t,A); grid on
xlabel('Time (s)')
ylabel('Temperature (C)')
subplot(2,1,2)
freq= (0:(2^NFFT - 1))/(2*n*dt);
plot(freq, amp_spec(1:(2^NFFT)); grid on
xlabel('Frequency (Hz)')
ylabel('Amplitude')
fY = fix(Y/100)*100;
ifY = ifft(fY);
cy = real(ifY);
figure
subplot(2,1,1)
plot(t,A); grid on
xlabel('Time (s)')
ylabel('Temperature (C)')
subplot(2,1,2)
plot(ti(1:L),cy(1:L)); grid on
axis
xlabel('Time (s)');
ylabel('Temperature (C)');
end
I'm wondering if I need a high passs filter. I've been trying to look into them, but I'm not sure how to customize them and what I should look at to customizq them.
Any help is appreciated!
Thanks,
Daniel
Answers (1)
Image Analyst
on 19 Feb 2013
0 votes
No, a high pass filter will let high frequency signals pass (survive). Spikes and peaks are high frequency signals and a high pass filter won't affect them much. You can to blur them to smooth them, so you want a low pass filter. Zero out the high frequencies and you should see your signal look smoother because the high frequencies (spikes, peaks) will be filtered out. Please post a screenshot of your signal.
Categories
Find more on Descriptive Statistics 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!