how to go about mapping a moving object (mapping toolbox)

2 次查看(过去 30 天)
Hi folks -
I have an interesting visualization problem, that I think is best suited to be created using the Mapping Toolbox, but I'm not quite sure what programmatic workflow to use. I need to, ideally animate, or statically represent, the movement of an array of sensors moving on a vehicle across a field. Basically, it's as if I have a linear array of 18 points moving in 2D space, but in a non-orthogonal way with respect to a lat long grid. I have, in the data provided to me, the location of the center of the array as it moves across the field, and values for each sensor in the array (18 sensors in all). The way I am thinking about the problem, is to define an object (as in OOP object) that defines the array. I want to display the array as a heat map based on the values of each sensor in the array. Then 'drop that in' to an image/map somehow, at the proper location and at the proper angle, for each location of the vehicle. I'm wondering (hoping?) there might be some tools in the mapping toolbox that might help me compartmentalize the problem? I'm trying to avoid having to determine the exact pixel location in a grid for each and every sensor position, and looking for functions that might help map an object, given the parameters of the object (what it looks like and how it is rotated). Or do I need to entirely write this from scratch? That's ok, but if there are any tools in Matlab that would make this easier, I'm all ears!

回答(2 个)

Kelly Kearney
Kelly Kearney 2016-8-22
It would help if you provided some more specifics... are your sensors arranged in a grid-like pattern, such that it makes sense to show the heatmap in a pcolor-like way, or are colored points, like a scatter plot, more appropriate?
An example of the latter is below (I arbitrarily arranged the sensors in a circle). The only difference between doing an animation on a projected axis vs a cartesian axis is that the plot object (in this example, the scatter object hs) holds post-projected x/y coordinates rather than the lat/lon coordinates used as input to scatterm, so you have to replicate this projection calculation prior to updating the scatter object x/y data.
% Center of array, at 100 time steps
clt = linspace(-80, 80, 100);
cln = linspace(0, 360, 100);
% Value of sensor
val = rand(18,100);
% Sensor location with respect to center
r = km2deg(1000);
th = linspace(0,2*pi,19);
th = th(1:end-1)';
dlt = r .* cos(th);
dln = r .* sin(th);
% Sensor location
lt = bsxfun(@plus, clt, dlt);
ln = wrapTo360(bsxfun(@plus, cln, dln));
% Plot time step 1
hax = worldmap('world');
C = load('coast');
geoshow(C);
hs = scatterm(lt(:,1), ln(:,1), [], val(:,1), 'filled');
% Update x-, y-, and cdata to produce animation
[x,y] = mfwdtran(lt, ln);
for it = 2:size(val,2)
set(hs.Children, 'xdata', x(:,it), 'ydata', y(:,it), 'cdata', val(:,it));
pause(0.1);
end
Is that the sort of thing you have in mind? If not, perhaps a sketch would help?

Cynthia Bresloff
Cynthia Bresloff 2016-8-22
Hi - I think this might give me enough to go on; I need a bit of time to digest it (not new to Matlab, but quite rusty, and new to the Mapping Toolbox). But I ran your script, and this is GREAT, at first glance. Thanks!

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by