淘先锋技术网

首页 1 2 3 4 5 6 7

X=[83 83 83 113 113 83.5 113.5 113.5 113.5 114 114.5 115 117.5 117.5 100 71 100 100.5 101 101.5 101.5 102 102.5 103 103.5 104.5 104.5 105.5 103.5 71.5 104.5 106.5 107 107.5 106 107 109 110 107.5 108 107.5 115 115.5 116 121.5 121.5 121.5 130 132.5 132.5 149 149 149 149 148 161 175 186.5 188.5 198.5 216.5 216.5 216.5 216.5 244.5 244.5 244.5 244.5 287 287 287 294.5 286.5 318.5 330.5 330.5 330.5 352 364 377 388 385 384.5 384.5 405 405 405 404.5 420 420 432 435.5 435.5 438 439.5 439.5 437.5 438.5 439 440]';

Y=[275 276.5 278 276 277.5 282.5 281 283 285.5 287.5 289.5 292 294.5 296.5 312.5 280.5 303 306 308 310 308 310.5 312 312 313.5 316.5 316.5 319 313.5 293.5 316 320.5 322.5 323.5 320 322.5 327 329 323.5 324.5 323.5 339.5 339.5 340.5 349 349 349 360.5 363.5 363.5 380 380 380 380 379 389.5 398.5 404.5 405.5 410 416 416 416 416 421.5 421.5 421.5 421.5 421.5 421.5 421.5 420.5 421.5 415 411 411 411 401.5 394.5 385.5 376.5 379 379.5 379.5 359 359 359 359.5 338.5 338.5 315 306.5 306.5 299 294 294 300.5 297.5 295.5 292]';

Z=0:1:99;  Z = Z';

plot3(X,Y,Z,'b');

xlabel('x');

ylabel('y');

zlabel('z');

hold on;

N = size(X,1);

t = 1 : N;

t = t';

t3 = t.^3;

t2 = t.^2;

t1 = t;

t0 = ones(N,1);

C = [t3,t2,t1,t0];

Ax = pinv(C)*X;

Ay = pinv(C)*Y;

Az = pinv(C)*Z;

x0 = Ax(1)*t.^3 +Ax(2)*t.^2 + Ax(3)*t + Ax(4);

y0 = Ay(1)*t.^3 +Ay(2)*t.^2 + Ay(3)*t + Ay(4);

z0 = Az(1)*t.^3 +Az(2)*t.^2 + Az(3)*t + Az(4);

plot3(x0,y0,z0,'r');

hold on