Fit my Data to a pattern with some unknown parameters
1 回表示 (過去 30 日間)
古いコメントを表示
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')
Main things to find here is "node".
I tried polyfit, smoothdata but not able to get it working.
Any suggestions.
1 件のコメント
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 Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!