Fitting the data so that one a single continuous line is achived

조회 수: 3 (최근 30일)
waqas
waqas 2019년 9월 4일
댓글: waqas 2019년 9월 4일
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
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.

답변 (1개)

KSSV
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
KSSV
KSSV 2019년 9월 4일
Try using smooth
imshow(I1)
hold on
plot(x,smooth(y),'r')
waqas
waqas 2019년 9월 4일
It is still giving almost the same fit. I reckon if some sort of trignomatric fit can give better conservation of orginal randomness of line. Line is basically depicting a crack and showing it as a smooth curve would be a simplified case which would cause problems in later stages of analysis.

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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by