cone plot (request for help)
Show older comments
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 Comments
darova
on 4 May 2019
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
on 4 May 2019
darova
on 4 May 2019
Can you attach entire code or plot? Still don't understand the task
darova
on 4 May 2019
I drew your vectors. They don't look like cone

Or Peer
on 4 May 2019
darova
on 4 May 2019
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
on 4 May 2019
Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!