Fitting the data so that one a single continuous line is achived
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have following line that I want to smooth out so that only one point will be there in one column:
![Annotation 2019-09-04 112619.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/236923/Annotation%202019-09-04%20112619.png)
mat file for the data is also attached. I tried to look for curve fitting and interpolation etc but could not comprehend how exactly tackle this.
0 个评论
回答(1 个)
KSSV
2019-9-4
I = imread('Annotation 2019-09-04 112619.png') ;
I1 = imcrop(I) ; % crop to remove white borders present around the image
I1 = rgb2gray(I1) ;
[y,x] = find(I1) ;
% Do fitting
p = polyfit(x,y,2) ;
xi = min(x):max(x) ;
yi = polyval(p,xi) ;
imshow(I1)
hold on
plot(xi,yi,'r')
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!