Kashif
Kashif

Reputation: 875

How to plot circular plot with mixed euclidean and polar coordinate parameters

I posted this question at math.stackexchange.com but I am not entirely sure if that is the correct community to post this question to. I chose the math site because I am able to represent the math equations which I would like to plot in a easy to read manner.

The link to the question is here: https://math.stackexchange.com/questions/220395/matlab-how-to-plot-circular-plot-with-mixed-euclidean-and-polar-coordinate-para

I hope I am not violating any rules by double-posting or posting in the wrong spot. Please feel free to correct me here.

Thanks all

Upvotes: 0

Views: 401

Answers (1)

bla
bla

Reputation: 26069

For simplicity I'll show the answer just for the first equation, I'm sure you'll understand how to apply it further on. Here's a how I produces the 3d matrix that represent the equation for x,y,theta while keeping L1 and L2 constant:

N=100; % grid points
rangex=linspace(-2,2,N);
rangey=linspace(-2,2,N);
ranget=linspace(-pi,pi,N);

[x,y,theta] = meshgrid(rangex,rangey,ranget);

L1 = 1; 
L2 =-1; 

A = x.^2+y.^2-2*L1*L2*cos(theta);

you can use several tools to visualize A=L1^2+L2^2, Here's one way:

p=patch(isosurface(x,y,theta,A,L1^2+L2^2))
set(p,'FaceColor','red','EdgeColor','none');
daspect([1,1,1])
view(3); axis tight
camlight 
lighting gouraud

enter image description here

Upvotes: 2

Related Questions