MATLAB Answers

Lines of longitude. How to merge points?

10 views (last 30 days)
Kamil Nowak
Kamil Nowak on 14 Nov 2017
Commented: Kamil Nowak on 19 Nov 2017
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):');
fi_s2=input('Enter fi s:');
round(x=Ct( : ));
round(y=Qt( : ));
disp('X,Y coordinates:')
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.


Sign in to comment.

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);


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!