How to do Gaussian Filter 1D?

조회 수: 426 (최근 30일)
Tyann Hardyn
Tyann Hardyn 2021년 12월 11일
편집: Tyann Hardyn 2021년 12월 11일
Hi, Community
I wanna ask about how to do a Gaussian Filter in just 1D data.... So i have a data vector based on time series like this :
And i want to filter the data by using Gaussian Filter. So, Anyone, How to do that? Thank you so much....

채택된 답변

Chunru
Chunru 2021년 12월 11일
x = readtimetable("IAGA Daily Magnetic Data (1m) Extraction 04-Jul-2021 (CTS).txt")
x = 1440×8 timetable
Time Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 __________ ________ _____ _____ _____ ____ _____ _____ _____ 2021-07-04 00:00:00 22494 47892 47882 0 22494 23.58 42280 2021-07-04 00:01:00 22494 47891 47882 0 22494 23.54 42280 2021-07-04 00:02:00 22494 47891 47882 0 22494 23.58 42280 2021-07-04 00:03:00 22494 47891 47882 0 22494 23.51 42280 2021-07-04 00:04:00 22494 47891 47882 0 22494 23.62 42280 2021-07-04 00:05:00 22494 47891 47882 0 22494 23.77 42280 2021-07-04 00:06:00 22494 47891 47881 0 22494 23.84 42280 2021-07-04 00:07:00 22494 47891 47881 0 22494 23.88 42280 2021-07-04 00:08:00 22494 47891 47881 0 22494 23.92 42280 2021-07-04 00:09:00 22494 47891 47882 0 22494 23.99 42280 2021-07-04 00:10:00 22494 47891 47882 0 22494 24.07 42280 2021-07-04 00:11:00 22494 47892 47882 0 22494 24.18 42280 2021-07-04 00:12:00 22494 47892 47882 0 22494 24.18 42280 2021-07-04 00:13:00 22495 47892 47882 0 22495 24.33 42280 2021-07-04 00:14:00 22495 47892 47882 0 22495 24.37 42280 2021-07-04 00:15:00 22495 47892 47882 0 22495 24.33 42280
w = gausswin(10, 2.5);
w = w/sum(w);
y = filter(w, 1, x.Var7);
plot(x.Var7, 'r'); hold on; plot(y, 'b');
legend('original', 'filtered')
  댓글 수: 2
Tyann Hardyn
Tyann Hardyn 2021년 12월 11일
Thats so Great, Sir. I ll try with Gausswin function right now. Because Iam trying by using :
data_noise = fullfile("Path", "IAGA Daily Magnetic Data (1m) Extraction 04-Jul-2021 (CTS).txt")
data_noise0 = detectImportOptions(data_noise, 'NumHeaderLines',0,'Delimiter', ' ', 'Whitespace', ' ',...
'ConsecutiveDelimitersRule', 'join', 'EmptyLineRule', 'skip', 'FileType','text');
data0_komph = data0.Var3;
time_ori = string(data0.Var2);
l_wak = length(data0_komph);
gauss_filt = fspecial('gaussian',[l_wak 1] ,10);
gauss_komph = conv(data0_komph,gauss_filt, 'same');
plot(time_ori, gauss_komph);
and the result is weird :
Its maybe the both of side (gauss filter) part which is symmetry was still remain....
Iam so grateful that someone can give me an Input Idea.... Thank You So Much
Tyann Hardyn
Tyann Hardyn 2021년 12월 11일
편집: Tyann Hardyn 2021년 12월 11일
Hi, Chunru
I have a problem when plotting the gaussian filter result and the original data....
What is x component you re used in Plot? Why it become a range between 0 - 1500 instead of time series data, which mean from 2021-07-04 00:00:00 until 2021-07-04 23:59:00?
I actually have a problem in Var6 Plot. I need to filter the var6 (Horizontal Magnetic Component) and not in var7

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by