cone plot (request for help)

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

What kind of data do you have?
simple cone:
n = 4; % number of phi
r = [2 5]; % radius change
phi = linspace(0,2*pi,n+1); % angle
[R, PHI] = meshgrid(r,phi);
x = R.*cos(PHI);
y = R.*sin(PHI);
z = repmat([1 0],n+1,1);
mesh(x,y,z)
Or Peer
Or Peer 2019년 5월 4일
edited my first qustion to give you the data. thanks for the help.
darova
darova 2019년 5월 4일
Can you attach entire code or plot? Still don't understand the task
darova
darova 2019년 5월 4일
I drew your vectors. They don't look like cone
img.png
they dont look like a cone because they are the edges of the ellipse figure ellipse.jpg
this is not the same data but close
with the code I entered above and a loop
for height=1:-50:-1000
ellipse(left,right,up,down,height)
end
it draws this figure
what I want is instead of multiple loops a drawing of a cone(continues error).
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개)

카테고리

태그

질문:

2019년 5월 4일

댓글:

2019년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by