Fit my Data to a pattern with some unknown parameters

1 回表示 (過去 30 日間)
Gopichandh Danala
Gopichandh Danala 2019 年 11 月 20 日
コメント済み: dpb 2019 年 11 月 20 日
Hi,
I have a array with some noise and want to correct it to a know pattern (line-like).
Here is an example:
% type-1
my_array1 = [1,2,3,4,5,6,7,8,9,10,11,...
12,13,14,15,16,17,18,19,20,21,22,...
23,23,22,21,20,19,19,17,16,16,14,14,...
35,10,10,9,8,40,41,42,43,44,45,46,...
1,2,3,4,5,6,7,8,9,10,11,12,13,14];
% type-2
my_array2 = [1,2,3,4,5,6,7,8,9,10,11,...
12,13,14,15,16,17,18,19,20,21,22,...
22,22,22,21,20,19,19,17,16,16,14,14,...
35,10,10,9,8,40,41,42,43,44,45,46,...
1,2,3,4,5,6,7,8,9,10,11,12,13,14];
my_arr_len = length(my_array1);
node = 23; % not known - needed to find
pattern = [1:node,node:-1:1];
len_pattern = length(pattern);
rem_len = my_arr_len - len_pattern;
pattern = [pattern, 1:rem_len];
figure,
subplot(121), plot(my_array1,'r')
hold on, plot(pattern, 'g--'), hold off
title('type 1')
subplot(122), plot(my_array2,'b')
hold on, plot(pattern, 'g--'), hold off
title('type 2')
Capture.PNG
Main things to find here is "node".
I tried polyfit, smoothdata but not able to get it working.
Any suggestions.
  1 件のコメント
dpb
dpb 2019 年 11 月 20 日
Looks like piecewise linear fit first then remove outliers and refit iteratively.
Or, try to identify the bad sections and remove what you can first that should make the initial fit somewhat closer.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by