XY-Graph Plot Latitude Longitude not working

조회 수: 1 (최근 30일)
Michael Koidis
Michael Koidis 2022년 2월 21일
답변: Avni Agrawal 2023년 11월 17일
Hi everybody,
im currently trying to collect GPS Points in Simulink and to Plot them with the XY Graph.
The linewidth should be 20. I checked everything. I changed it so XY Plot instead of Map and there is data visible.
(Only some example data. geoplot is working)

답변 (1개)

Avni Agrawal
Avni Agrawal 2023년 11월 17일
Hi,
I understand that you are trying to plot a xy graph with latitude and longitude.The 'geoplot' function is used to create a 2D line plot of geographic coordinates on a map.
% Define the latitude and longitude coordinates
lat = [35.6895 51.5074]; % latitudes of Tokyo and London
lon = [139.6917 -0.1278]; % longitudes of Tokyo and London
% Create a geographic plot
figure
geoplot(lat, lon, 'r-')
geobasemap('landcover') % set the basemap
% Add a marker at each point
hold on
geoplot(lat, lon, 'ro')
hold off
% Add labels
text(lat(1), lon(1), 'Tokyo', 'HorizontalAlignment', 'right')
text(lat(2), lon(2), 'London', 'HorizontalAlignment', 'right')
% Add title
title('Geographic plot from Tokyo to London')
Please take a look at this documentation for better understanding:
I hope this helps.

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by