필터 지우기
필터 지우기

cone plot (request for help)

조회 수: 2 (최근 30일)
Or Peer
Or Peer 2019년 5월 4일
댓글: Or Peer 2019년 5월 4일
I have 4 normalized vectors that represent the edges of error ellipse, how do I plot a cone between them that represent the error area up until a certain point(x*10,y*10,z*10) for example.
in other words, a semi cone with no head ( there is an "head" if the error in the head is tiny enought to count as the same point for every vector).
for example I have a data of vectors 2x3 where first line is the direction vector and line 2 is point of origin
left:
0.000777551633326096 -0.324338092709069 -0.904293501718821
-0.0155631822372405 6.49182977305030 18.1
right:
-0.0740720973626052 -0.324366480207892 -0.904433163158820
1.48237041373031 6.49139541860418 18.1
up:
-0.0366252121589512 -0.373079389279788 -0.904694864673741
0.732751302082479 7.46410442862344 18.1
down:
-0.0366693335703280 -0.275625183637174 -0.904031684016283
0.734172208073828 5.51840816205618 18.1
right now I have a code of drawing ellipse at a given height which then I loop to give me the ellipse error over length
function ellipse(left,right,up,down,height)
left(1,1:3)=left(1,1:3)*(height/left(1,3))+left(2,1:3);
right(1,1:3)=right(1,1:3)*(height/right(1,3))+right(2,1:3);
up(1,1:3)=up(1,1:3).*(height/up(1,3))+up(2,1:3);
down(1,1:3)=down(1,1:3).*(height/down(1, 3))+down(2,1:3);
x=mean([min([left(1),right(1),up(1),down(1)]),max([left(1),right(1),up(1),down(1)])]);
y=mean([min([left(1,2),right(1,2),up(1,2),down(1,2)]),max([left(1,2),right(1,2),up(1,2),down(1,2)])]);
t=0:0.1:2*pi;
Xt=0.5*norm(left-right)*cos(t)+x;
Yt=0.5*norm(up-down)*sin(t)+y;
Z=t-t+height;
plot3(Xt,Yt,Z,'color','green');
hold on;
  댓글 수: 7
darova
darova 2019년 5월 4일
If you have all profiles for surface, just rebuild your function header
function [Xt, Yt, Z] = ellipse(left,right,up,down,height)
Write all profiles in matrix
i = 1;
for height=1:-50:-1000
[x,y,z] = ellipse(left,right,up,down,height)
X(:,i) = x;
Y(:,i) = y;
Z(:,i) = z;
i = i + 1;
end
And create surface
surf(X,Y,Z)
Or Peer
Or Peer 2019년 5월 4일
thank you, the code worked.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by