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-')

采纳的回答

KSSV
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 个)

类别

Help CenterFile Exchange 中查找有关 Least Squares 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by