필터 지우기
필터 지우기

Spatial filtering from FFT results

조회 수: 6 (최근 30일)
Wookie
Wookie 2022년 3월 11일
답변: Mathieu NOE 2022년 3월 21일
I have a spatial signal that has frequencies that I'd like to filter out, the signal is seen below. I need some advice in removing those valleys and leaving just the top portion. I still need the large valley seen around 700.
My code to filter it has been:
dx=0.2; %mm
Fs=1/dx; %1/mm
L = length(metrology_s1); % Length of signal
t = (0:L-1)*Fs;
Y = fft(metrology_s1);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
From here I am not applying filters correctly:
% Second attempt
wo = 0.012207/(.2); %
bw = wo/.5;
[b,a] = iirnotch(wo,bw);
fil = filtfilt(b,a,metrology_s1);
Any advice?

답변 (1개)

Mathieu NOE
Mathieu NOE 2022년 3월 21일
hello
my suggestion below
look at the yellow trace
y = readmatrix('metrology_s1.csv');
samples = numel(y);
% create x vector
dx = 0.2;
Fs = 1/dx;
x = (0:samples-1)*dx;
% smooth data
ys = smoothdata(y,'rloess',300);
% add min (max negative) point
[y_min,ind] = min(y);
x_min = x(ind);
%create an exponential window centered on the negative peak and use that to
%"blend" the smoothed data with the raw data
blend_ratio = exp(-(x-x_min).^4/1000);
% plot(x,blend_ratio); % debug / test only
y_blended = ys.*(1-blend_ratio)+ y.*(blend_ratio);
plot(x,y,x,ys,x,y_blended)
legend('raw','smoothed','blended');

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by