find x points which makes a best fit to a curve
古いコメントを表示
Hallo Matlab forum.
I need help to figure out how to reduce a curve described by 10.000 points to a curve described by less than 50 points and still have the best fit.

All my curves have the shape showen in the plot above, and as shown the problem is around the maximum and in the "tail" after.
I am currently reducing the amount of points by following two steps:
1: Remove point ii if the slope between point e(ii-1,1) to e(ii,1) is the same as the slope between point e(ii,1) to e(ii+1,1).
n = length(e) ;
for i = 1:n-2
ii = n-i ;
if abs((e(ii-1,2)-e(ii,2))/(e(ii-1,1)-e(ii,1)) - (e(ii,2)-e(ii+1,2))/(e(ii,1)-e(ii+1,1))) < 0.001
e(ii,:) = [];
end
end
2: Remove every 2nd row if there is still more than 50 rows left.
while length(e)>50
n = length(e) ;
dz = e(end-2,1) - e(end-1,1) ; % Stepsize.
for i = 2:2:n-15
ii = n-i ;
if (e(ii,1)-e(ii+1,1)) - dz < 0.001 && (e(ii-1,1)-e(ii,1)) - dz < 0.001
e(ii,:) = [];
end
end
end
What else can i do to improve the fitting of the curve with small amount of points?
採用された回答
その他の回答 (1 件)
per isakson
2013 年 12 月 10 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Fit Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
