How to add three dimensional data points to MATLAB

I want to add 3D data points associated with spacecraft debris positions in space. Do I create a 3 x n matrix of Latitude, Longitude, Altitude? The goal is to use the multiobjective genetic algroithm to locate the maximum density of debris objects at a given point in time and plot it.

6 Comments

How you have the points? I mean in what format?
Here is an example of one object. There are thousands that would need to go into a matrix.
Latitude -85.27494, Longitude, -132.52163, Altitude 790 kilometers, where -latitude is south of the equator and -longitude is west of the prime meridian (PM).
Latitude is 0 to 90 degrees in nothern hemishere and 0 to -90 in the southern hemisphere.
Longitude is 0 to 180 degrees east of the PM and 0 to -180 west of the PM.
Hope this helps.
Thanks for helping me.
Are you asking how to create such data or how to organize data that you already have!?
The goal is very unclear.
To create such a 3D grid,
>> n = 100;
>> lat = linspace(-90,90,n);
>> lon = linspace(-180,180,n);
>> alt = linspace(0,1000,n);
>> [LA,LO,AL] = meshgrid(lat,lon,alt);
Thank you for helping me.
I do have the data and I am looking to organize and display it in grid like you have provided.
Some examples of the data are:
Latitude, Longitude, Altitude
-85.27494, -132.52163, 790 km
-85.90271, -133.11105, 790 km
-85.91974, -145.27083, 790 km
-85.63104, -149.66237, 790 km
-85.68855, -158.26341, 790 km
Do I use something like the following to access the data from an array?
ineedX = find(Xgrid >= 0 & Xgrid <= 90);
ineedY = find(Ygrid >= -180 & Ygrid <= 180);
ineedZ = find(Zgrid >= 650 & Zgrid <= 850);
DataExtract = Data(ineedX,ineedY,ineedZ);
n = 100;
lat = linspace(-90,90,n);
lon = linspace(-180,180,n);
alt = linspace(0,1000,n);
[LA,LO,AL] = meshgrid(lat,lon,alt);
Better to use logical indexing; if your data are a mx3 matrix as you show above,
ineedX = longitude >= 0 & longitude <= 90;
ineedY = latitude >= -180 & latitude <= 180;
ineedZ = altitude >= 650 & altitude <= 850;
select = ineedX & ineedY & ineedZ;
m(select, :)

Sign in to comment.

More Answers (0)

Products

Release

R2019b

Asked:

on 14 Sep 2020

Commented:

on 15 Sep 2020

Community Treasure Hunt

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

Start Hunting!