Generating large circles using scircle

Hello. I have a question about scircle2 function. Basically I am using that function to generate a circle given centre and radius like this
[lat, lon] = scircle2(centreX,centreY,centreX+rad,centreY);
and then i plot this using
plot(lat,lon);
For small values of cen and rad, i can see the circle no problem. But for large values say over 100, the lat and lon are messed up and the circle is messed up too. Is there a problem with large values with this function? If so, how can i generate a matrix that contains the circle so i can plot it?

 Akzeptierte Antwort

Chad Greene
Chad Greene am 31 Jul. 2016

1 Stimme

I don't think scircle2 wants x or y values, it wants lats and lons. I wrote a circlem function that streamlines the process of plotting circles of a given radius on a map. Perhaps that is what you're looking for?

4 Kommentare

Walter Roberson
Walter Roberson am 31 Jul. 2016
Right scircle2 uses the first lat/long as the base and uses the second lat/long to compute the distances. For the initial code, a rad over 100 would be a radius of over 100 degrees.
I am curious now, Chad, as to the results for your program when the distance implies crossing a pole.
Chad Greene
Chad Greene am 1 Aug. 2016
Hi Walter, I just checked and for a circle centered on (89S,5E) with a 300 km radius and another for a 1300 km radius they get around the South Pole just fine.
Sam Tong
Sam Tong am 1 Aug. 2016
circlem is just what i needed thanks
Walter Roberson
Walter Roberson am 1 Aug. 2016
With large enough radii, the effects with circlem is the same as what I showed with scircle2. (I thought I had detected a problem but it was because I had forgotten about the factor of 2*Pi in converting Earth radius to circumference.)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 31 Jul. 2016

1 Stimme

I do not think there is any problem. When you start crossing the poles then the points that are a particular distance away (which is what scircle2 calculates) stops being a simple circle.
For example, modifying the example from scircle2:
axesm('mercator','MapLatlimit',[-90 90],'MapLonLimit',[-180 180]);
load coast
plotm(lat,long,'k');
lat1 = -48; lon1 = 77.5;
plotm(lat1, lon1, 'b*');
lat2 = lat1 + [0 10 20 30 40 50 60 70 80 90 100].';
lon2 = repmat(85.5, size(lat2));
plotm(lat2, lon2, 'r*');
[latc,lonc] = scircle2(lat1,lon1,lat2,lon2);
plotm(latc,lonc,'g');
Once your small circle is big enough to cross the pole, then there start to be points to the side that are the right distance away

1 Kommentar

Sam Tong
Sam Tong am 31 Jul. 2016
Ok thank you. That makes sense. Maybe I am misinterpreting the use of this function.
I want a function that generates perfect geometric circles (of any size) say on a xy-coordinate system. Is this the wrong function to use? If so, is there another function for this job?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by