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