clear clc data_line1 = xlsread('24.xlsx','Sheet1','A1:C30');%写入字符串 x1 = data_line1(:,1); y1 = data_line1(:,2); z1 = data_line1(:,3); Point1 = [x4 y4 z4]; num = length(Point1); t1=linspace(-0.15,-0.01);%有效范围 F=@(p)arrayfun(@(n) norm(cross(Point1(n,:)-[p(1),p(2),p(3)],[p(4),p(5),p(6)]))/norm([p(4),p(5),p(6)]),[1:size(Point1,1)]); p=lsqnonlin(F,[Point1(1,:),Point1(2,:),Point1(3,:),Point1(4,:),Point1(5,:),Point1(6,:)]); plot3(x1,y1,z1,'go'); plot3(p(1)+t1*p(4),p(2)+t1*p(5),p(3)+t1*p(6),'r-','LineWidth',1.2);
标签:line1,t1,Point1,散点,Matlab,拟合,y1,data From: https://www.cnblogs.com/s206/p/17318746.html