필터 지우기
필터 지우기

I want to join these cubic hermite curve, how can i do that?

조회 수: 2 (최근 30일)
Avtar Singh
Avtar Singh 2014년 8월 23일
clear all
a=[1,1,0;4,4,1;7,5,1;15,2,1;6,4,3]
n = input('enter the number of passing points of curve:--->>')
A= zeros(n,n); %n must be greater than 3
for i=2:n-1 % loop from 2nd to (n-1) row A(i,:) = [zeros(1,i-2),[1 4 1],zeros(1,n-i-1)]; %explicit structure of row i end
A(1,1)=1;
A(n,n)=1;
R=[0 0 0; 3*(a(3,:)-a(1,:)); 3*(a(4,:)-a(2,:));3*(a(5,:)-a(3,:));0 0 0];
X=inv(A)
T=X*R;
u=[0:0.01:1]'
U=[u.^3 u.^u u u.^0];
M=[2 -2 1 1;-3 3 -2 -1 ;0 0 1 0;1 0 0 0];
B=[a(1,:);a(2,:);0 0 0;T(2,:)];
P=U*M*B;
plot3(P(:,1),P(:,2),P(:,3));
hold on
B1=[a(2,:);a(3,:);T(2,:);T(3,:)];
P1=U*M*B1;
plot3(P1(:,1),P1(:,2),P1(:,3));
hold on
B=[a(3,:);a(4,:);T(3,:);T(4,:)];
P=U*M*B;
plot3(P(:,1),P(:,2),P(:,3));

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by