フィルターのクリア

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 Center および File ExchangeMultirate Signal Processing についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by