I have encountered a problem and would like to ask everyone to help solve it. The problem to be solved is how to close the following two fitted curves. Thank you very much for your enthusiastic answers.
조회 수: 1 (최근 30일)
이전 댓글 표시
My code:
load dataA.mat
%x1=dataA(:,1);
%y1=dataA(:,2);
f1 = fit(xAbove,yAbove,'smoothingspline','SmoothingParam',0.0001);%smoothingspline
%plot(f1,xAbove,yAbove)
plot(f1,'-r')
hold on
load dataB.mat
%x2=dataB(:,1);
%y2=dataB(:,2);
[xx,ind] = sort(xBelow);
yy2 = smooth(xBelow,yBelow,0.5,'rloess');
yy=yy2(ind);
xAbove(1)==xx(1);
yAbove(1)==yy(1);
plot(xx,yy,'r-')
댓글 수: 0
채택된 답변
KSSV
2021년 1월 20일
load dataA.mat
%x1=dataA(:,1);
%y1=dataA(:,2);
f1 = fit(xAbove,yAbove,'smoothingspline','SmoothingParam',0.0001);%smoothingspline
%plot(f1,xAbove,yAbove)
% plot(f1,'-r')
xx1 = xAbove ;
yy1 = f1(xx1) ;
hold on
load dataB.mat
%x2=dataB(:,1);
%y2=dataB(:,2);
[xx,ind] = sort(xBelow);
yy2 = smooth(xBelow,yBelow,0.5,'rloess');
yy=yy2(ind);
xAbove(1)=xx(1);
yAbove(1)=yy(1);
xx = [xx1 ; flipud(xx) ; xx1(1)] ;
yy = [yy1 ; flipud(yy); yy1(1)] ;
plot(xx,yy,'r-')
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!