http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252
MATLAB Central Newsreader  Plot latitudelongitude of a cone
Feed for thread: Plot latitudelongitude of a cone
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Wed, 24 Nov 2010 11:24:04 +0000
Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#798939
Geant Bepi
Hello Matlab people!<br>
<br>
I need to plot the latitudelongitude of a cone in my graphs (so essentially a circle).<br>
<br>
But the funny thing is I know only the width of cone in degrees (e.g 60deg cone). <br>
<br>
In reality if the cone (60deg) is placed at lets say 0lat, 0lon then on a latittude map it would appear as a circle having it's centre at 0lat, 180lon and radius 60 deg.<br>
<br>
now my issue is how to get Matlab to plot the latitudelongitude of this circle (or in some cases a curve  depending on where the cone is placed) with following knowns;<br>
1) width of the view cone in deg<br>
2) origin<br>
<br>
can someone give me a hint where to start? <br>
should i consider doing it the easy way taking radius as 60deg straight away.. ?

Wed, 24 Nov 2010 13:05:05 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#798961
Geant Bepi
I tried using "scircle1"<br>
but it gives an error as 'not a valid map axes'<br>
my map is already a latitude longitue plot!<br>
<br>
how to go about this? <br>
<br>
"Geant Bepi" <timothyschru_useonlywhatsbeforeunderscore@yahoo.co.uk> wrote in message <iciskk$rs1$1@fred.mathworks.com>...<br>
> Hello Matlab people!<br>
> <br>
> I need to plot the latitudelongitude of a cone in my graphs (so essentially a circle).<br>
> <br>
> But the funny thing is I know only the width of cone in degrees (e.g 60deg cone). <br>
> <br>
> In reality if the cone (60deg) is placed at lets say 0lat, 0lon then on a latittude map it would appear as a circle having it's centre at 0lat, 180lon and radius 60 deg.<br>
> <br>
> now my issue is how to get Matlab to plot the latitudelongitude of this circle (or in some cases a curve  depending on where the cone is placed) with following knowns;<br>
> 1) width of the view cone in deg<br>
> 2) origin<br>
> <br>
> can someone give me a hint where to start? <br>
> should i consider doing it the easy way taking radius as 60deg straight away.. ?

Sat, 04 Dec 2010 15:15:10 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#801818
Geant Bepi
I still couldn't come up with a working algorithm for this problem..<br>
appreciate if someone can shed some light in the right direction?

Tue, 07 Dec 2010 15:30:24 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#802593
Geant Bepi
In other words how to represent following mathematical expression in Matlab;<br>
let's represent the location of the 'cone' on the sphere with following angles,<br>
theta1,2 = latitude<br>
phi1,2 = longitude<br>
alfa = cone width<br>
<br>
theta1, phi1 and alfa are known values<br>
so we have;<br>
cos(theta1)*cos(theta2)*cos(phi1)*cos(phi2) + cos(theta1)*cos(theta2)*sin(phi1)*sin(phi2) + sin(theta1)sin(theta2) = cos(alfa)<br>
<br>
now what I need is to draw the contour of, f(theta2,phi2) = LHS<br>
<br>
I tried several methods on matlab without much help...<br>
I think I missing something here in my attempt to expressing the function "f" with two unknowns in Matlab.

Tue, 07 Dec 2010 15:59:21 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#802611
Geant Bepi
I really hope someone out there is able to understand this problem....I'm sitting on this far too long now :)

Tue, 07 Dec 2010 16:48:05 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#802631
Kelly Kearney
"Geant Bepi" <timothyschru_useonlywhatsbeforeunderscore@yahoo.co.uk> wrote in message <icj2i1$k8p$1@fred.mathworks.com>...<br>
> I tried using "scircle1"<br>
> but it gives an error as 'not a valid map axes'<br>
> my map is already a latitude longitue plot!<br>
> <br>
> how to go about this? <br>
> <br>
<br>
> > now my issue is how to get Matlab to plot the latitudelongitude of this circle (or in some cases a curve  depending on where the cone is placed) with following knowns;<br>
> > 1) width of the view cone in deg<br>
> > 2) origin<br>
> > <br>
> > can someone give me a hint where to start? <br>
> > should i consider doing it the easy way taking radius as 60deg straight away.. ?<br>
<br>
If I'm clear on what you're attempting (not sure exactly what the cone you refer to looks like, but plotting a geographic circle I can do), then scircle1 should be the right function. That function itself only calculates the small circle coordinates, and doesn't plot them, so your error must be arising from a different command (plotm?).<br>
<br>
When you say your plot is a longitudelatitude plot, do you mean it's a map axes, created via axesm? Or simply that it's a cartesian axis labeled with longitude and latitude? The plotm command can only target a map axis of the former type. If you don't need to worry about map projections for your purposes, just use plot on a regular axis.<br>
<br>
If this doesn't solve the problem, try posting a small snippet of code that causes the error.<br>
<br>
Kelly

Mon, 13 Dec 2010 16:40:26 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#804389
Geant Bepi
"Kelly Kearney" <kakearney@nospamgmail.com> wrote in message <idlog5$rdc$1@fred.mathworks.com>...<br>
> "Geant Bepi" <timothyschru_useonlywhatsbeforeunderscore@yahoo.co.uk> wrote in message <icj2i1$k8p$1@fred.mathworks.com>...<br>
> > I tried using "scircle1"<br>
> > but it gives an error as 'not a valid map axes'<br>
> > my map is already a latitude longitue plot!<br>
> > <br>
> > how to go about this? <br>
> > <br>
> <br>
> > > now my issue is how to get Matlab to plot the latitudelongitude of this circle (or in some cases a curve  depending on where the cone is placed) with following knowns;<br>
> > > 1) width of the view cone in deg<br>
> > > 2) origin<br>
> > > <br>
> > > can someone give me a hint where to start? <br>
> > > should i consider doing it the easy way taking radius as 60deg straight away.. ?<br>
> <br>
> If I'm clear on what you're attempting (not sure exactly what the cone you refer to looks like, but plotting a geographic circle I can do), then scircle1 should be the right function. That function itself only calculates the small circle coordinates, and doesn't plot them, so your error must be arising from a different command (plotm?).<br>
> <br>
> When you say your plot is a longitudelatitude plot, do you mean it's a map axes, created via axesm? Or simply that it's a cartesian axis labeled with longitude and latitude? The plotm command can only target a map axis of the former type. If you don't need to worry about map projections for your purposes, just use plot on a regular axis.<br>
> <br>
> If this doesn't solve the problem, try posting a small snippet of code that causes the error.<br>
> <br>
> Kelly<br>
<br>
THANK YOU for the reply Kelly.<br>
<br>
Well 'scircle1' works but not quite the way I want.<br>
<br>
I want to find a way to have matlab use my calculation when determining the latitude longitude of the boundary.<br>
<br>
For e.g., i calculate the point in space as a 1x3 matrix;<br>
n=[sin(theta);0;cos(theta)] % theta is known!<br>
now how can I convert this matrix 'n' to latitude and longitude so that I can use it as the input to 'scircle1'<br>
<br>
appreciate your help!<br>
thx

Tue, 14 Dec 2010 14:15:26 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#804671
Rob Comer
"Geant Bepi" <timothyschru_useonlywhatsbeforeunderscore@yahoo.co.uk> wrote in message <ie5i9q$bja$1@fred.mathworks.com>...> For e.g., i calculate the point in space as a 1x3 matrix;<br>
> n=[sin(theta);0;cos(theta)] % theta is known!<br>
> now how can I convert this matrix 'n' to latitude and longitude so that I can use it as the input to 'scircle1'<br>
<br>
It looks as if theta is an angle in radians, but you need to provide a complete definition.<br>
<br>
It looks as if n is a unit vector in some 3D Cartesian system, but which system? That's critical.<br>
<br>
If the system is ECEF, for example (see the definition here: <a href="http://www.mathworks.com/help/toolbox/map/ref/geodetic2ecef.html">http://www.mathworks.com/help/toolbox/map/ref/geodetic2ecef.html</a>), and theta is the distance from the north pole on a unit sphere (such that 0 <= theta <= pi), then you'd in the y == 0 plane and, more specifically, on the prime meridian. So longitude would be 0. And latitude (in radians) would be pi/2  theta. Try to verify this for yourself. But bear in mind that while selfconsistent this interpretation is just a wild guess, because you haven't defined your angle or coordinates.<br>
<br>
Rob Comer<br>
Mapping Toolbox Development<br>
Mathworks

Wed, 15 Dec 2010 13:51:15 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#804997
Geant Bepi
"Rob Comer" <rob.comer.nospam@mathworks.com> wrote in message <ie7u5u$cs2$1@fred.mathworks.com>...<br>
<br>
Ok I'll try to elaborate everything I mentioned in above posts.<br>
<br>
There's a circle above a sphere ( for e.g., a viewcone of a satellite orbiting the Earth). I have to plot the area covered by the circle (so, essentially a smallcircle with a radius "r" (scircle1)) on a latitudelongitude map. <br>
<br>
There are several viewcones (circles) looking at the Earth in different angles. <br>
<<<< for e.g., if it's only one circle then the calculation becomes simpler.<br>
theta1,2 = latitude<br>
phi1,2 = longitude<br>
alfa = cone width (radius)<br>
<br>
theta1, phi1 and alfa are known values<br>
Thus;<br>
cos(theta1)*cos(theta2)*cos(phi1)*cos(phi2) + cos(theta1)*cos(theta2)*sin(phi1)*sin(phi2) + sin(theta1)sin(theta2) = cos(alfa)<br>
<br>
then I can draw the corresponding circle in Matlab as;<br>
[atheta1, aphi1] = antipode(theta1,phi1) % antipode of theta1 and phi1<br>
[theta2, phi2]=scircle1(atheta1,phi1,alfa)<br>
plot(theta2,phi2,'k') >>>><br>
<br>
Therefore, I have the following rotation matrix from which I calculate the position and attitude of the viewcones.<br>
<br>
R1=[cos(theta) 0 sin(theta); 0 1 0; sin(theta) 0 cos(theta)]<br>
R2=[cos(pi/4) sin(pi/4) 0; sin(pi/4) cos(pi/4) 0; 0 0 1]<br>
so as you can see we rotate only on x and z axes. <br>
R1R2=[3x3MATRIX]<br>
<br>
n1=[sin(theta);0;cos(theta)] % n1 is the first circle and correspond to the 3rd column of R1R2 matrix (z axis).<br>
<br>
angle theta is the latitude in degrees. We are on the prime meridian, so longitude is 0.<br>
radius of the circle is also known in degrees.<br>
<br>
Now the issue I'm confronted with is to draw n1. any ideas?<br>
Please let me know if the information is not clear to you...

Fri, 17 Dec 2010 16:42:08 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#805684
Geant Bepi
<br>
Need your attention!<br>
<br>
help me please

Sat, 18 Dec 2010 16:50:28 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#805869
Geant Bepi
anyone at least today?

Sat, 18 Dec 2010 17:36:35 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#805871
Walter Roberson
On 18/12/10 10:50 AM, Geant Bepi wrote:<br>
> anyone at least today?<br>
<br>
None of the regular posters has (to my recollection) ever given evidence <br>
of having used the Mapping Toolbox, so I am not surprised that you have <br>
not received any responses.<br>
<br>
You should consider contacting Mathworks Technical Support.

Sat, 18 Dec 2010 17:47:04 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#805874
Geant Bepi
Walter Roberson <roberson@hushmail.com> wrote in message <Di6Po.4415$2G7.482@newsfe13.iad>...<br>
> On 18/12/10 10:50 AM, Geant Bepi wrote:<br>
> > anyone at least today?<br>
> <br>
> None of the regular posters has (to my recollection) ever given evidence <br>
> of having used the Mapping Toolbox, so I am not surprised that you have <br>
> not received any responses.<br>
> <br>
> You should consider contacting Mathworks Technical Support.<br>
<br>
Do you think (in your opinion) I explicitly 'have' to use the Mapping Toolbox in order to perform this task?<br>
<br>
I'm a kindaa novice matlab user but I thought this is fairly easy task on Matlab well, at least the mathematics involved are basic and easy....

Sat, 18 Dec 2010 18:40:20 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#805884
Walter Roberson
On 18/12/10 11:47 AM, Geant Bepi wrote:<br>
<br>
> Do you think (in your opinion) I explicitly 'have' to use the Mapping<br>
> Toolbox in order to perform this task?<br>
><br>
> I'm a kindaa novice matlab user but I thought this is fairly easy task<br>
> on Matlab well, at least the mathematics involved are basic and easy....<br>
<br>
Myself, I would prefer not to have to replicate the functionality of the <br>
Mapping Toolbox to be able to plot arbitrary shapes on to lattitude / <br>
longitude plots, having to take in to account the irregular spheroid <br>
shape of the Earth.<br>
<br>
Though in typing that, I realize that it was not clear to me whether the <br>
circles you wanted to plot should be in Euclidean geometry or in Earth <br>
geometry? I did not grasp from your question what the circles represent. <br>
If they represent things that equidistant from a given surface point, <br>
then they could be quite irregular indeed if elevation is taken in to <br>
account (e.g., in a canyon) and need to take in to account the curvature <br>
of the Earth even if distance from the center of the Earth is considered <br>
to be fixed.

Sun, 19 Dec 2010 23:26:04 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#806105
Rob Comer
"Geant Bepi" <timothyschru_useonlywhatsbeforeunderscore@yahoo.co.uk> wrote in message <ieah4j$m02$1@fred.mathworks.com>...<br>
> There's a circle above a sphere ( for e.g., a viewcone of a satellite orbiting the Earth). I have to plot the area covered by the circle (so, essentially a smallcircle with a radius "r" (scircle1)) on a latitudelongitude map. <br>
> <br>
> There are several viewcones (circles) looking at the Earth in different angles. <br>
> <<<< for e.g., if it's only one circle then the calculation becomes simpler.<br>
> theta1,2 = latitude<br>
> phi1,2 = longitude<br>
> alfa = cone width (radius)<br>
> <br>
> theta1, phi1 and alfa are known values<br>
> Thus;<br>
> cos(theta1)*cos(theta2)*cos(phi1)*cos(phi2) + cos(theta1)*cos(theta2)*sin(phi1)*sin(phi2) + sin(theta1)sin(theta2) = cos(alfa)<br>
<br>
It's not clear to my why this would be true.<br>
<br>
> then I can draw the corresponding circle in Matlab as;<br>
> [atheta1, aphi1] = antipode(theta1,phi1) % antipode of theta1 and phi1<br>
> [theta2, phi2]=scircle1(atheta1,phi1,alfa)<br>
<br>
Why construct a circle about the antipode. How does this work?<br>
<br>
> Therefore, I have the following rotation matrix from which I calculate the position and attitude of the viewcones.<br>
> <br>
> R1=[cos(theta) 0 sin(theta); 0 1 0; sin(theta) 0 cos(theta)]<br>
> R2=[cos(pi/4) sin(pi/4) 0; sin(pi/4) cos(pi/4) 0; 0 0 1]<br>
> so as you can see we rotate only on x and z axes. <br>
<br>
But what _are_ the x and z axes? I asked about that earlier, but you didn't answer my question.<br>
<br>
> n1=[sin(theta);0;cos(theta)] % n1 is the first circle and correspond to the 3rd column of R1R2 matrix (z axis).<br>
<br>
> Now the issue I'm confronted with is to draw n1. any ideas?<br>
<br>
As I explained, it looks like n1 is a unit vector, but you're calling it a circle. I'm puzzled about that.<br>
<br>
 Rob

Wed, 02 Feb 2011 16:05:04 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#816941
Geant Bepi
Ok! I'll try to break the problem in to simpler parts.<br>
<br>
There's a circle above a sphere ( for e.g., a viewcone of a satellite orbiting the Earth).<br>
Plot the area covered by the circle (so, essentially a smallcircle with a radius "r" (scircle1)) on a latitudelongitude map.<br>
Consider an orbit around a perfect sphere.<br>
<br>
We know the location of the satellite (i.e., latitude (theta), longitude(phi), altitude) and the radius of the circle (alfa). Throughout the calculation longitude and altitude remain constant.<br>
<br>
The position and attitude of the five windows (above mentioned viewcone) of the satellite looking at different directions (one is pointed upwards and the other four are perpendicular to the one pointed upwards and perpendicular to each other) is calculated from the following rotation matrix;<br>
<br>
R1=[cos(theta) 0 sin(theta); 0 1 0; sin(theta) 0 cos(theta)]<br>
R2=[cos(pi/4) sin(pi/4) 0; sin(pi/4) cos(pi/4) 0; 0 0 1]<br>
<br>
from R1R2 matrix we get five unit vectors;<br>
n1=[sin(atheta1); 0; cos(atheta1)];<br>
n2=[cos(atheta1)/sqrt(2); 1/sqrt(2); sin(atheta1)/sqrt(2)];<br>
n3=[cos(atheta1)/sqrt(2); 1/sqrt(2); sin(atheta1)/sqrt(2)];<br>
n4=n2;<br>
n5=n3;<br>
<br>
My problem starts here.<br>
For n1 I used a different method and drew the area covered by the circle as follows;<br>
<br>
Since we know latitude, longitude and radius of the circle,<br>
<br>
[atheta1,aphi1]=antipode(theta1,phi1);<br>
[theta2,phi2]=scircle1(atheta1,aphi1,alfa);<br>
H = plot(phi2,theta2,'k');<br>
<br>
This part of the code does exactly what I want and plot the boundary of the area covered by the first circle (represented by n1), on the latitudelongitude map that I am generating. It is important to note that our final projection should be on this latitudelongitude map.<br>
<br>
But I have no clue as to how to repeat this to n2 through n5.<br>
<br>
Probably you already noticed that we did not need any help from the rotation matrix or n1 unit vector to draw the area covered by the first circle. Since we have five circles I calculated the above five unit vectors (n1  n5) that represent each of the circles.<br>
<br>
How do I move forward from here. How do I get MATLAB to solve n1 so that I can plot the area covered by it.<br>
<br>
I hope i explained the problem clearly. Any tip, help is greatly appreciated.<br>
<br>
Thanks

Mon, 21 Feb 2011 12:20:21 +0000
Re: Plot latitudelongitude of a cone
http://www.mathworks.com/matlabcentral/newsreader/view_thread/297252#820577
Geant Bepi
"Rob Comer" <rob.comer.nospam@mathworks.com> wrote in message <iem4ac$8ef$1@fred.mathworks.com>...<br>
<br>
>><br>
<br>
Is there anyone who can look at the problem I am having...<br>
please