Lines of longitude. How to merge points?

1 view (last 30 days)
Welcome, At first I apologize for my English level.
I made a script:
fi2=input('Enter latitude (initial value:interval:final value for example. 0:20:90):');
lambda2=input('Enter longitude (initial value:interval:final value for example. -180:20:180):');
R=6378;
fi_s2=input('Enter fi s:');
fi_s=deg2rad(fi_s2);
fi=deg2rad(fi2);
lambda=deg2rad(lambda2);
ro=[R*sin(fi_s)*cot(fi)];
c=[cos(lambda)];
C=ro'*c;
Ct=C';
round(x=Ct( : ));
q=[sin(lambda)];
Q=ro'*q;
Qt=Q';
round(y=Qt( : ));
disp('X,Y coordinates:')
xy=round([x,y])
plot(x,y,'-x'),
xlabel('Coordinate "y"')
ylabel('Coordinate "x"')
title('Cartographic grid ')
grid on
As a result, I got this drawing:
But I need something like that:
The data I used to get the grid (first screen):
How to conect points to get lines of longitude (meridians)? At this moment I have only parallels.
Nobody in Poland can't help my. I hope you know the answer ;)
Thanks for your help.

Accepted Answer

Kelly Kearney
Kelly Kearney on 14 Nov 2017
Assuming this is a first step in mapping something a bit more complicated, I'd suggest using an existing mapping toolbox rather than trying to calculate all the projections from scratch. If you have the Mapping Toolbox available in your license, you can use that. Alternatively, there's the popular m_map toolbox.
ax(1) = subplot(1,2,1);
h = axesm('ortho', ...
'origin', [90 0 0], ...
'grid', 'on', ...
'glinestyle', '-', ...
'meridianlabel', 'on', ...
'parallellabel', 'on', ...
'mlinelocation', 20, ...
'plinelocation', 20, ...
'mlabelparallel', 18, ...
'maplatlimit', [19 90], ...
'fontsize', 8);
set(h, 'visible', 'off');
ax(2) = subplot(1,2,2);
m_proj('ortho', 'lat', 90, 'long', 0);
m_grid('linestyle','-', ...
'ytick',20:20:80, ...
'xtick', -180:20:360, ...
'fontsize', 8);
  2 Comments
Kelly Kearney
Kelly Kearney on 15 Nov 2017
There are a few syntax errors in your code... for example,
round(x=Ct( : ));
isn't valid Matlab. I assume you meant
x = round(Ct);
or similar? Plus you haven't provided the appropriate input parameters (e.g. what is fi_s?)
But as a hint, you already have your x- and y-coordinates. The plot command draws one line per column of input coordinates. Based on the way you've oriented your matrices, this corresponds to your latitude circles. So, what would you get if you transpose those matrices and plot?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!